containers-roadmap icon indicating copy to clipboard operation
containers-roadmap copied to clipboard

Can't see task level cpu/memory utilization in cloudwatch

Open rutchkiwi opened this issue 10 years ago • 37 comments

Hi!

In my team we're using ECS to run services. The ECS agent collect a bunch of metrics, that we can then view in cloudwatch. Especially useful for us is the memory/cpu utilization metric, that we use to tune how much memory and cpu we allocate to services. This is really nice that in that it allows us to catch services that are running on dangerously high memory before they go to 100% and get killed by the agent.

In our cluster we're also running a bunch of scheduled tasks, like ETLs, daily cleanups, sending emails at specific times etc. These are run by simply starting ECS tasks.

In cloudwatch, we can only see ECS cluster and service level metrics, not task level ones. This means that we can't see how much memory/cpu these tasks use (as they are not running under a ECS service)

It would be really nice to get these metrics for these kind of short-lived tasks as well. Are there any plans to support this in cloudwatch?

thanks for any replies!

rutchkiwi avatar Oct 21 '16 16:10 rutchkiwi

+1

christianblunden avatar Oct 21 '16 18:10 christianblunden

Is this a limitation of the agent or cloudwatch?

billyshambrook avatar Jan 04 '17 05:01 billyshambrook

+1 for task level monitoring

atifrizwan89 avatar Sep 05 '17 12:09 atifrizwan89

+1 it would be nice to have an official response at least telling us whether cloudwatch will eventually offer this

skatenerd avatar Dec 08 '17 20:12 skatenerd

@billyshambrook More likely a limitation of ECS itself, and the metrics it is emitting to Cloudwatch. The current dimensions are ClusterName and ServiceName: http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ecs-metricscollected.html

bramswenson avatar Dec 08 '17 20:12 bramswenson

+1 for adding a dimension for TaskName to these metrics. Without it we can't really get a full picture of what's running on the cluster, only what's running in a service. Tasks scheduled based on things like Cloudwatch events are invisible

jonathonsim avatar Jan 27 '18 02:01 jonathonsim

Hello,

One of the reasons for not having utilization metrics more granular than service name is the ephemeral nature of Task IDs. Publishing utilization metrics by task IDs can lead to metric spam as most of these tasks are short-lived by nature. It's also very hard to alarm on something as ephemeral as task IDs. Having something that's more human readable and generated makes it easier to do these things.

Emitting utilization metrics aggregated by task definition family and version strings is something that is sort of a middle ground here, which we have considered as an alternative here. Is that something that you think would prove to be helpful here?

Thanks, Anirudh

aaithal avatar Jan 30 '18 00:01 aaithal

@aaithal - I think that would give us what we need for our use case

jonathonsim avatar Jan 30 '18 00:01 jonathonsim

Yes. @aaithal That can be helpful. An alternative can also be to have a completely new metric such as "maxMemoryUtilization" which will track max memory among all tasks in a ecs service.

mdamir avatar Feb 11 '18 10:02 mdamir

+1 a task container name does not change that much right? Is that an alternative to use as task metric?

bashilbers avatar Feb 20 '18 15:02 bashilbers

+1

jrodr12 avatar Apr 16 '18 15:04 jrodr12

+1

mandeepbal avatar May 03 '18 19:05 mandeepbal

+1

dustinbolton avatar Jun 22 '18 05:06 dustinbolton

+1

hlopezvg avatar Jul 24 '18 16:07 hlopezvg

+1

milanbrahmbhatt avatar Aug 07 '18 20:08 milanbrahmbhatt

Another reason for insight into task-level metrics is for helping debug issues. I have Service A and it runs 30 tasks. By other means (i.e. alerting on CloudWatch events from the ECS Agent) I get notification that 1 or 2 tasks get stopped due to an OutOfMemoryError. When I view service-level metrics and look at max memory utilization during the timeframe that said tasks are stopped, the max utilization is < 80%.

According to documentation:

Service memory utilization (metrics that are filtered by ClusterName and ServiceName) is measured as the total memory in use by the tasks that belong to the service, divided by the total memory that is reserved for the tasks that belong to the service.

Out of my 30 tasks, only 2 of them were stopped due to memory pressure. What about the other tasks? Are they only utilizing a small percentage compared to the 2 that fell over? Or, were they high in utilization as well and only 2 tasks hit that breaking point? Knowing that makes a difference - either you don't have enough capacity overall or you have some code that in certain data scenarios is using a ton of memory.

If you already know the "total memory in use by the tasks that belong to the service" to be able to show us the overall utilization, I'm hoping that based on the conversations/feedback above, you'll find a way to expose it that makes sense to those looking for it. Thanks for listening! :)

blues4ugrl avatar Aug 29 '18 20:08 blues4ugrl

+1

It's hard for me to recommend ECS as a container solution without being able to monitor basic container-level metrics. The burden is being pushed on your consumers to develop our own means of container resource monitoring.

I wrote PowerShell and Python scripts to ship these metrics to CloudWatch, but depending on the number of containers you're running across your environments, the cost can be quite ridiculous. I recommend shipping these metrics to another monitoring solution if you have lots of containers.

waffleshop avatar Sep 14 '18 13:09 waffleshop

+1

ryanpagel avatar Sep 22 '18 07:09 ryanpagel

+1

vimmis avatar Oct 18 '18 17:10 vimmis

Thanks for the feedback. I wanted to let you know that the ECS team is aware of this issue, and that it is under active consideration. We always appreciate +1's and additional details on use cases.

coultn avatar Oct 31 '18 20:10 coultn