VM 上的 Azure "Percentage CPU" 指标

Azure "Percentage CPU" metric on a VM

它究竟在测量什么?

我在 Azure 中有一个 Debian VM 16 vCPUs。我将它用于 运行 tensorflow。 Azure 门户上的指标“百分比 CPU”显示平均值为 33.5%。我担心的是我可能无法充分利用所有 16 vCPUs.

真正让我不解的是,top命令显示了600%CPU的支配Python进程。为什么这个数字和 Azure 的 33.5% 不一致?

一度怀疑tensflow的线程数不够用。然而,当我 increased the tensorflow threads from 5 to 15 时,Azure "Percentage CPU" 保持在 33.5% 不变。 top -H 确实显示了增加的线程数。

更新:

请参阅下面已接受的答案。在 top 屏幕中,键入 1,它显示使用了所有 CPU:

所以 Azure 的 "Percentage CPU" 指标是 %CPU 你用 top 命令看到的。平均值表示所有 CPU 的平均值 %CPU

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.

不,我不这么认为。 16个vCPU都用了

你可以检查这个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.

您可以执行top,然后输入1。您将看到单个 CPU 用法。

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

根据 Azure 支持团队,Azure 基本指标 "Percentage CPU" 显示来宾 OS(运行 您的程序)实际使用了多少物理节点。所以 33% 意味着它实际上完全使用了大约 5 个 vCPU。请注意,当 运行.

中的 OS 时,扩展指标 "CPU Percentage Guest OS" 显示了访客 OS 认为正在使用的内容