amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

Starting tasks that were on a draining ECS instance does not honour placement strategies

Open FahadMustafa opened this issue 8 years ago • 1 comments

I've got the following placement strategies set on my service:

- AZ Spread
- Binpack CPU

For example assume the cluster looks like this:

Availability zone A:
 - ECS Instance 1: has 5 tasks
 - ECS Instance 2: has 3 tasks

Availability zone B:
 - ECS Instance 3: has 5 tasks

Availability zone C:
 - ECS Instance 4: has 5 tasks

When scaling down lets assume ECS Instance 2 is removed from the cluster, I set the instance to "DRAINING" before terminating it. I expect the 3 tasks on it to be spread across the AZs but what I end up with is this:

Availability zone A:
 - ECS Instance 1: has 8 tasks

Availability zone B:
 - ECS Instance 3: has 5 tasks

Availability zone C:
 - ECS Instance 4: has 5 tasks

Image a larger number of tasks per instance and you can see how the cluster will get very imbalanced. Is there a way to sort this out ?

FahadMustafa avatar Feb 11 '18 21:02 FahadMustafa

@FahadMustafa There may be other constraints such as resources, attributes which can decide the placement of tasks. Could you please reach out via AWS forums or support to further debug this, since it is not directly related to agent? Closing this issue, please feel free to reopen if there are concerns. Thanks.

sharanyad avatar Feb 12 '18 22:02 sharanyad