[ECS] [request]: Seperate LoadBalancer traffic distribution from lifecycle mgmt.
Tell us about your request Separate load balancer health check to serve traffic but not killing the tasks and the let the container health checks kill the tasks if required. This should help to not kill tasks that are currently under load. On ECS side, you would need to configure the behavior of how tasks are killed. We experienced issues where the ECS containers where under heavy load and could not serve LB health checks temporary, which resulted in LB to kill tasks because it considered them unhealthy.
Which service(s) is this request for? Fargate, ECS
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? Today it is not possible to separate the idea of "is a task able to receive traffic" and "is a task alive and working". First this needs to be separated and second managed by different parties. While the LB only would be responsible to serve traffic, the ECS system should decide if a tasks needs restarting.
Are you currently working around this issue? no solution
Additional context K8S has a similar concept.
Attachments
@adlemich Thanks for the suggestion! Is this the same feature as https://github.com/aws/containers-roadmap/issues/251? Or do you view them as different?
Hi. I think they are related, both require a decoupling of the automation between ECS container status and load distribution. So a container may have a state "paused" or "overloaded" or other states where it is required to not send more traffic to it, while it is actually in a healthy state. In my case, it is required that the LB cannot kill an ECS task because of an overloaded situation at the task, which might required additional steps for a solution
In other words, we want the same Function as Kubernetes' Readiness Probes.
We also have an application where only one ECS task behaves as an under heavy load Role, and if that task goes down, the Role fails over to another ECS task.
As a workaround, we run a cron every minute to deregister-targets the ECS task for the specific role of the application from the target group to stop traffic from LB.
We'd like to be able to run more expensive and more frequent checks on startup ("readiness"), then less frequent and more lightweight checks after that ("health").
Currently you have to funnel everything through the same health check settings, which means a compromise - eg if you want to try and reduce painfully slow deployment times, you might reduce the health check interval, but this means after deployment you're generating a ton of health checks you might not otherwise want.
Similarly, you might have a health check thats reasonably expensive, eg check a database is contactable. This is bad to include as a health check, especially if you have multiple load balancers hitting you, but it might make sense to include as a startup readiness check.
We have shipped an improvement to ECS scheduler, that would prioritize starting a new healthy tasks, before killing tasks that were marked unhealthy. You can read more in this WNP: https://aws.amazon.com/about-aws/whats-new/2023/10/amazon-ecs-applications-resiliency-unpredictable-load-spikes/ Blog post with deep dive: https://aws.amazon.com/blogs/containers/a-deep-dive-into-amazon-ecs-task-health-and-task-replacement/
This is especially funny when we in the company get a trainings from AWS consultants about resilience improvements, where they suggest to distinguish between ALB health-checks and runtime health-checks so that in case of connectivity issue to let's say DB, the tasks could be taken out of ALB but not killed so that they would have a chance to get back, when connectivity is back again.
By ECS does not allow to implement this out of the box.