neurite
neurite

Reputation: 2824

Azure "Percentage CPU" metric on a VM

What exactly is it measuring?

I have an Debian VM in Azure with 16 vCPUs. I am using it to run tensorflow. The metric "Percentage CPU" on Azure Portal shows 33.5% average. My concern is that I might not fully utilize all the 16 vCPUs.

What really puzzles me is that the top command shows a dominating Python process of 600% CPU. Why is this number not consistent with Azure's 33.5%?

At one point, I was suspecting the number of tensflow threads is not enough. However, when I increased the tensorflow threads from 5 to 15, Azure "Percentage CPU" remained unchanged at 33.5%. top -H did show the increased number of threads though.

UPDATE:

See the accepted answer below. In the top screen, type 1, it shows all the CPUs are used:

enter image description here

So Azure's "Percentage CPU" metric is %CPU you see with top command. Average meaning the average %CPU of all the CPUs.

Upvotes: 1

Views: 5966

Answers (2)

jatsl
jatsl

Reputation: 21

Per Azure support team, Azure basic metric "Percentage CPU" shows how much of the physical node the Guest OS (running your program) is actually using. So 33% means it is actually using around 5 vCPUs fully. Note that the extended metric "CPU Percentage Guest OS" shows what the Guest OS thinks is being used when the Guest OS in running.

Upvotes: 2

Shui shengbao
Shui shengbao

Reputation: 19223

Does this imply only 6 out of the 16 vCPUs are used?The math is that 1 vCPU is counted by top as 100% CPU. So 600% shown by top means 6 vCPUs are used.

No, I don't think so. 16 vCPUs are all used.

You could check this answer.

%CPU -- CPU Usage : The percentage of your CPU that is being used by the process. By default, top displays this as a percentage of a single CPU. On multi-core systems, you can have percentages that are greater than 100%. For example, if 3 cores are at 60% use, top will show a CPU use of 180%. See [here][2] for more information. You can toggle this behavior by hitting Shifti while top is running to show the overall percentage of available CPUs in use.

You could execute top, then enter 1. You will see single CPU usage.

top - 01:32:05 up 9 min,  1 user,  load average: 0.15, 0.38, 0.33
Tasks: 110 total,   1 running, 109 sleeping,   0 stopped,   0 zombie
%Cpu0  :  1.0 us,  0.0 sy,  0.0 ni, 87.8 id, 11.2 wa,  0.0 hi,  0.0 si,  0.0 st

Upvotes: 1

Related Questions