CPU Utilization questions

3,109 views
Skip to first unread message

Jacob Edward

unread,
Feb 27, 2018, 2:45:00 PM2/27/18
to gce-discussion
I've been running a Node JS process on GCE and noticed on the console page that the CPU utilization will spike in the beginning to around 2% but then will always flat line off to 1%... at first I thought this was because of V8 but then I found this question on Stackoverflow for maxing out the CPU with the shell, tried a couple of the answers and am getting the same result as the JavaScript... anybody know what's going on?  Has anybody else experienced anything differently?  Lol makes me paranoid I'm going 100 times slower than I could be but that sounds ridiculous on a single thread, right?

Digil (Google Cloud Platform Support)

unread,
Feb 28, 2018, 12:11:06 AM2/28/18
to gce-discussion
The CPU usage of main Dashboard of the GCP differs from that of an instance's individual CPU usage. You may need to check the discussions links(link1, link2, link3) on similar concerns, which had posted by other community members. Let me know if this clarifies your issue.

Jacob Edward

unread,
Mar 1, 2018, 2:21:14 PM3/1/18
to Digil (Google Cloud Platform Support), gce-discussion
>> The CPU usage in Google Cloud Console is not that of the instance, but the CPU usage of the container managing it. This container is in charge of providing the virtualization services to the instance and collecting all the metrics. So, the Google Cloud Console CPU utilization shows the aggregate CPU usage for both the container and the instance.<<

This is the response from the StackOverflow website but their scoring system is sorta limiting since I don't really spend enough time actually using that site to get those tens of thousands of points lol, so silly, but this response has me asking more questions than I started with and there's no way for me to comment directly...

So my compute engine instance, running on a fully blocking infinite loop from the shell environment only accounts for 1% of total potential resources for that single VM and the container virtualizing the VM...  How do I get the container to virtualize at 100%...

On Tue, Feb 27, 2018 at 9:11 PM, 'Digil (Google Cloud Platform Support)' via gce-discussion <gce-dis...@googlegroups.com> wrote:
The CPU usage of main Dashboard of the GCP differs from that of an instance's individual CPU usage. You may need to check the discussions links(link1, link2, link3) on similar concerns, which had posted by other community members. Let me know if this clarifies your issue.

--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-discussion@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/IEBFHW4D8m8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussion+unsubscribe@googlegroups.com.
To post to this group, send email to gce-discussion@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/4fab90fb-a1c0-47f2-b875-d919766dc995%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Fady (Google Cloud Platform)

unread,
Mar 1, 2018, 7:09:15 PM3/1/18
to gce-discussion

Hello Jacob,


In order to check the CPU utilization, you can use the “ top” command from within your GCE linux instance. Check this thread for multiple core metrics.  Also, for stress testing, you may install this third party stress tool and run it for at least two minutes as to have it reflect properly on the graph, here is an example (tip: ssh using a new shell while keeping the top command running in the old shell to monitor the spike of usage) :


sudo stress --cpu  8 --timeout 120


The command should get the CPU utilization near 100% for two minutes. You may verify that using the top command (different shell) and through the graph. While stressing the instance, make sure that the graph is set to 1 hour, as the longer the period the bigger the chance that the graph may average and flatten the result. I hope this helps.

Jacob Edward

unread,
Mar 1, 2018, 7:50:01 PM3/1/18
to Fady (Google Cloud Platform), gce-discussion
So I installed Stress and ran two timeout sessions so you could more easily see it on the graph...  




Started the second Stress while the aggregate was still dropping to zero but then as you can see it levels off again at 1%...



​aka nowhere near 100%...  lol what do I do?

Digil (Google Cloud Platform Support)

unread,
Mar 2, 2018, 10:29:13 PM3/2/18
to gce-dis...@googlegroups.com
Hello Jacob,

The graph that you are seeing in the main dashboard of the GCP Platform is not individual instance's utilization graph. It is the fraction(instance/cpu/utilization)
of the allocated CPU that is currently in use for the instance in the GCP. If you want to monitor your individual instance's 'CPU utilization' percentage, go to the Compute Engine Dashboard[screenshot.png], then select the instance[screenshot2.png] you want to check and monitor the CPU utilization[screenshot3.png] there.


screenshot.png
screenshot2.png
screenshot3.png

Jacob Edward

unread,
Mar 3, 2018, 1:44:36 PM3/3/18
to Digil (Google Cloud Platform Support), gce-discussion
Ok, so I am seeing the proper CPU loads now, thanks!  Weird that the CPU can exceed 100% but I suppose I don't care enough about those details lol




I don't suppose it's possible to use the CPU responsible for processing the virtualization (the other graph that would always level out at 1%) for custom threads in your actual project or is it just this locked down formality GCP uses... weird they would put that CPU utilization on the main console page instead of your actual VM... anybody know why they chose to do that?

Fady (Google Cloud Platform)

unread,
Mar 3, 2018, 6:26:46 PM3/3/18
to gce-discussion

Jacob,


The graph on the main dashboard is displaying the metrics as expected. Both metrics are actually the same but displayed differently. The difference is that on the main dashboard, it is displayed in decimal form. For example: 0.01= 1% and  0.1= 10% .. 1.0= 100%. In your case it may have even reached 2.5 = 250%. This is also expected for instances that allow bursting, a feature that allows the instance for short period of times to use additional physical CPU.  I hope this clarifies the confusion.


Jacob Edward

unread,
Mar 3, 2018, 7:26:34 PM3/3/18
to Fady (Google Cloud Platform), gce-discussion
Fascinating, lol wish the units were marked or they probably were and I kept glancing over it lol, thanks for telling me!

Digil (Google Cloud Platform Support)

unread,
Mar 4, 2018, 8:10:05 PM3/4/18
to gce-dis...@googlegroups.com
Hello Jacob,

A detailed description of the various GCP metrics can be found under the 'Description Labels' as well. You can go through it for your future reference.
Reply all
Reply to author
Forward
0 new messages