1
votes

I'm seeing some discrepancy between ECS service and EC2 in terms of CPU utilization metrics.

We have an EC2 instance of t2 small type and two different ECS containers running inside it. I have allocated 512 CPU units for one container and 128 CPU units for the other container. Here, the problem is that the CPU utilization goes up to > 90% and the following is the screenshot, enter image description here

While the CPU utilization of underlying EC2 is not even greater than 40% and the following is the screenshot, enter image description here

What could be the reason for this discrepancy? What could have been gone wrong?

1

1 Answers

1
votes

Well, if you assign CPU units to your containers, CloudWatch will report the CPU usage in relation to the available CPU capacity. Your container with 512 CPU units has access to 0.5 vCPUs and the one with 128 Units has access to 0.125 of a vCPU, which is not a lot, so a high utilization of those is easy to achieve.

Since the CPU utilization of the t2.small, which has about 1 vCPU (ignoring the credit/bursting system for now) is hovering around 20%, my guess is that the first graph is from the smaller container.