Home > Blockchain >  Get mem and cpu usage from AWS fargate task
Get mem and cpu usage from AWS fargate task

Time:12-22

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.

CodePudding user response:

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

CodePudding user response:

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

  • Related