skip to Main Content

What APIs are available for tasks running under ECS fargate service to get their own memory and CPU usage?

My use case is for load shedding / adjusting: task is an executor which retrieves work items from a queue and processes in parallel. If load is low it should take on more tasks, if high – shed or take on less tasks.

2

Answers


  1. You can get those metrics in CloudWatch by enabling Container Insights. Note that there is an added cost for enabling that.

    Login or Signup to reply.
  2. You can look at Cloudwatch Container Insights. Container Insights reports CPU utilization relative to instance capacity. So if the container is using only 0.2 vCPU on an instance with 2 CPUs and nothing else is running on the instance, then the CPU utilization will only be reported as 10%.
    Whereas Average CPU utilization is based on the ratio of CPU utilization relative to reservation. So if the container reserves 0.25 vCPU and it’s actually using 0.2 vCPU, then the average CPU utilization (assuming a single task) is 80%. More details about the ECS metrics can be found here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search