ALB - nginx proxy_next_upstream functionality

0

nginx has a feature called proxy_next_upstream where it will retry a request against another upstream if an error occurs on the 1st upstream it tries, such as an error, timeout, or certain http code:

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

Does similar functionality exist in an ALB where it retries a request against another target if the 1st target fails?

In my example, I have 2 EC2 webservers behind an ALB, and if I reboot one of them or it has another issue, could the ALB immediately start redirecting traffic to the other EC2? I have the Health Check at 5 seconds, but hoping to avoid the downtime waiting for the Health Checks to fail.

Or is there another way to avoid downtime in a scenario like this?

Thank you for your help.

已提问 7 个月前673 查看次数
1 回答
0

If you need to reboot an EC2, remove it from the target group before you reboot it so that the connections are drained and you don’t have the issue waiting for the health checks to time out.

After the reboot add it back in.

You can do this automatically such as when patching using SSM lifecycle.

profile picture
专家
已回答 7 个月前
profile picture
专家
已审核 7 个月前
  • Thanks, I will check into removing the EC2 from the target group for reboots. Are there any options for unplanned outages such as if the webserver stops responding? I see the minimum HealthCheckIntervalSeconds is 5 and UnhealthyThresholdCount is 2, so I believe that means there will be at most 10 seconds of downtime where end users will get http 502 errors trying to access my website. Is there any way to have a faster failover since I already have a 2nd (or 3rd or more) webserver in the load balancer?

    I suppose I could write my own script to check the webserver health on a faster interval and remove it from the target group myself, but curious if there was a better way.

    Thanks again for your help.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则