Why does top and Google Compute Engine give me two totally seperate cpu % values?

5

1

So to preface this, I haven't done much in Linux since a decade ago when I was in college, so I may just be doing something stupid.

However, for this project I am working on I'm performing a load test on two machines under a specific scenario and trying to get CPU and RAM data. I am however receiving wildly different values between Google Compute Engine performance data and data from the actual virtual machine.

I've been running this load test for 10 minutes so far, and running top shows:

top - 17:58:41 up 7 days, 10:17, 2 users, load average: 0.00, 0.00, 0.00

Tasks: 82 total, 1 running, 81 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.3%us, 1.0%sy, 0.0%ni, 98.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 1741288k total, 514704k used, 1226584k free, 146748k buffers

Swap: 0k total, 0k used, 0k free, 192572k cached

This makes me think this operation is using 0.3% of my cpu. However, looking at the Google Compute engine VM instances dashboard, and selecting this exact machine) it's showing constant 16-18% cpu for for the past 5 minutes.

Is there a reason I am missing about the discrepancy between the two?

KallDrexx

Posted 2014-08-24T18:01:21.873

Reputation: 331

What machine type are you using? This may be caused by the virtualization technique they are using. For example this can be observed on hosts without hardware virtualization support on Virtualbox when you set execution cap for machine (for example 50%). The linux's top will show you 30% of your CPU, but it would be in fact 60% of the resources provided to the machine. I don't use nor have any experience with Google Compute Engine, but this may be an explanation. – Enbyted – 2016-10-28T18:24:58.513

No answers