周国能
周国能
Sep 3, 2018 · 1 min read

Really nice post, and thank you.

I am building a similar auto scaling project inspired by your solution. And I found an edge case which may result in an incorrect ‘schedulable_containers’ metric with embedded gist.

Let’s say there are two EC2 instances:

  1. instance-001(remaining cpu: 10000, remaining memory: 4000)

2. instance-002(remaining cpu:4000, remaining memory: 10000)

And there two tasks:

  1. task-1 needs 1024 cpu and 4096 memory

2. task-2 needs 4096 cpu and 1024 memory

In such a case, the gist will send 0 as the ‘schedulable_containers’ metric, but actually 2 task1 can be scheduled in instance-002, and 2 task2 can be scheduled in instance-001