I am running an python script on an ec2 instance that inserts rows in an database on another instance. In ec2's monitoring I saw a 100% cpu utilization, whereas top only shows 20% for the python process. What is missing from top? Network overhead?
-
What about all the *other* processes? – Ladadadada Jun 20 '12 at 13:40
-
At around 0% utilization – RickyA Jun 20 '12 at 13:48
-
I am also in dillima, I send my TOP command reprot to the client :) – Manish Shrivastava Dec 16 '16 at 08:43
2 Answers
The data exposed by top
is often insufficient or misleading in virtualized environments like Amazon EC2 and the reported percentage depends on your instance type and the underlying processor core utilization (which usually doesn't match the virtualized hardware you are presented with from the hypervisor), amongst other things - what you are seeing is most likely caused by respective CPU steal time as exposed in most related Unix/Linux monitoring tools nowadays - see e.g. columns %steal or st in sar
or top
:
st -- Steal Time
The amount of CPU 'stolen' from this virtual machine by the hypervisor for other tasks (such as running another virtual machine).
The blog post EC2 monitoring: the case of stolen CPU provides a nice exploration and illustration of this topic:
When the top command displays 40% CPU busy but CloudWatch says the server is maxed out at 100% — which side do you take? The answer is simple (CloudWatch is correct, top is not) [...]
Please note that this hypervisor metric seems to be (easily) accessible on Unix/Linux systems only, but doesn't seem to be observable on Windows (yet), see my question Is there a Windows equivalent of Unix 'CPU steal time'? for more regarding this problem.
- 137
- 7
- 5,560
- 35
- 55
-
2Thanks for the blogpost. That really makes it clear. It is really good to know this since I am about to roll out Ganglia, and it would be a shame to measure the wrong metrics. Measure %idletime! – RickyA Jun 20 '12 at 15:01
-
In my case, cloudwatch is also reporting 3mb/s network usage, but when I look on my server (with iftop, iptraf, netstat, etc) I see that the only thing with a network connection is my ssh into the server. Which I really doubt is using 3mb/s... – Benubird Feb 27 '15 at 08:37
Amazon probably check load and no percentage usage from TOP. If you have two processes on cpu, they can be utilized on 20% but you can have load 2.
-
-
You can have system load at 2. Two processes on CPU but with low utilization. – MartinSVK Jun 20 '12 at 13:57