Empty Target Group Keep Receiving Traffic

1

I've the following architecture:

  1. Weight based elastic load-balancer [20% on my main target group #2.1, 80% on my spot target group #2.2]
  2. Two Target groups:
    1. Main Target Group: which contains on-demand EC2 instances [currently contains 1 instance only]
    2. Spots Target Group: which contains initiated EC2 instances by spot request [spot request with termination policy when an instance exceed predefined cost limit, the instance gets terminated and lost]
  3. Route53 that route the traffic to ELB by Alias [#1]

Recently my spot EC2 instance gets terminated which result spot target group to be empty, after that I started to receive 503 http response code when I sent a request over the load-balancer, and that happens only when the traffic gets routed by ELB to the spot target group.

Based on this article , empty target groups is considered as unhealthy, so why in my case the empty target group keep receiving traffic while it's unhealthy? is that the expected flow? what are the possible solutions to avoid that case?

Thanks.

已提問 1 年前檢視次數 583 次
2 個答案
1

If a target group contains only unhealthy registered targets, the load balancer routes requests to all those targets, regardless of their health status. This means that if all targets fail health checks at the same time in all enabled Availability Zones, the load balancer fails open. The effect of the fail-open is to allow traffic to all targets in all enabled Availability Zones, regardless of their health status, based on the load balancing algorithm : https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html

To avoid this scenario you might want to deploy a different logic of LB using a non-spot baseline : https://aws.amazon.com/blogs/compute/running-web-applications-on-amazon-ec2-spot-instances/

AWS
專家
已回答 1 年前
profile picture
專家
已審閱 1 年前
0

That IS the expected flow. Your weighted routing policy is still sending 80% of your traffic to the spot target group, even when empty. The simplest fix would probably be to create a new launch template that puts your spot instances in an auto-scaling-group. You can use a mixed-instance policy in the ASG to make sure not all of your spot fleet is stopped at once.

profile picture
jwesley
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南