How do I troubleshoot high CPU utilization on an Amazon ECS task on Fargate?

2 minute read
0

I want to find out why the CPU utilization is high on my Amazon Elastic Container Service (Amazon ECS) tasks on AWS Fargate.

Resolution

To troubleshoot high CPU utilization on an Amazon ECS task, complete one of the following tasks.

High CPU utilization for Fargate tasks that are part of a service

To troubleshoot high CPU utilization for Fargate tasks that are part of a service, complete the following steps:

  1. To view service-level CPU utilization, use Amazon CloudWatch metrics.
  2. Check if there is an ongoing deployment in the Amazon ECS service. During a deployment, there are more tasks running and the aggregate CPU utilization of the Amazon ECS service increases. After a deployment is complete, aggregate CPU utilization decreases.

If there isn't an ongoing deployment, then complete the following tasks:

Review your application logs

Check your application logs to see if your tasks are performing CPU-intensive operations. The logs are exported to different destinations based on your logging driver. If you use the awslogs driver, then the logs are exported to CloudWatch. The CPU-intensive operation can vary based on the application that's deployed in the Fargate task.

Review your CloudWatch metrics

Review the CloudWatch metrics of your load balancer for an increase in incoming traffic to your Amazon ECS service. If there is increased traffic to your tasks, then use Auto Scaling to increase the desired number of tasks running in the service. Incoming traffic can be distributed to a higher number of tasks and can reduce the overall CPU utilization of your tasks.

High CPU utilization for standalone Fargate tasks

To view task-level metrics through performance logs, turn on CloudWatch Container Insights. For more information, see Setting up Container Insights on Amazon ECS.

If your application's containers must perform CPU-intensive workloads, then upgrade to a larger task size that includes more virtual CPU (vCPU) and memory. For more information, see AWS Fargate Pricing.

AWS OFFICIAL
AWS OFFICIALUpdated 4 months ago