Reputation: 41
For a service running on ECS, we have configured autoscaling at task-definition(based on metrics such as memory usage, hit count, etc.). However, when the memory reaches the set limit, there is a delay in launching a new task, causing some hits to be missed during this time. How can we overcome this lag in new task placement, and are there any alternative approaches?
Upvotes: 0
Views: 89
Reputation: 695
In parallel to what Mark has mentioned,
Also check the health check attributes of a target group of your load balancer(assuming that you are using one). A newly registered target must pass health checks before traffic can be routed to it.
Lets assume following health check settings for an alb's target group,
This means in a perfect scenario, newly registered target will be ready to serve between 2-3 minutes.
Upvotes: 0
Reputation: 200998
How much of a delay are you seeing exactly? Between the delay in the metrics being reported, and the delay in the ECS auto-scaling action, and then the time it takes for ECS to load the docker image, and the time for the app to start and become healthy before a load balancer will send requests to it. If that is a problem, you should configure a lower threshold for your auto-scaling so that a new task is started a bit before your hard limits are reached.
Upvotes: 0