CPU Usage Discrepency
-
Hello,
I am troubleshooting CPU usage on a certain VM/host. This host is dedicated to one VM, and the VM has all 12 threads the physical host has. However, the graphs in XO for the host and VM do not match.
Here's the 2 hour CPU usage on the VM:
And here's the 2 our CPU usage on the host:
Here is the VM CPU settings:
Shouldn't these graphs match given the host is running a single VM, and the VM has all 12 threads? According to the host the CPU is barely being used, while the VM has high usage on multiple cores.Am I losing performance at all?
-
@toragmichael Hi,
First you don't have only one VM on your host, you also have your dom0 that is running there.
Second on one side you have virtual CPU attach to a VM on the other you have the physical CPU attached to the hardware so not having the sale result is quit normal.
Still 37% usage for one VM is quit a lot, mostly I think you are using your host heavily.
For the performance part I'm really not sure without testing it trying to push your host further could result in better or worth perf because an hypervisor is not really optimise to run only one VM but more to share the ressources between VMs. -
You have to think your VM as a "process" from Xen perspective (like a program using 100% of one CPU, it might be scheduled on different cores by your operating system).
One vCPU inside the VM can be scheduled to different physical cores (when you think it's the same vCPU, it might be various physical CPUs). That's the role of the Xen scheduler (called
credit2
). -
That's quite interesting!
It makes sense, that the scheduler "rotates" the load over the cores, but it wonders me, that the "single-threaded-load" of the VM is not shown on the whole system.
Shouldn't one core be at least at 75%, if one core in the VM is at 75%?
-
It's because possibly your thread is spread once one a physical CPU, then on another CPU, then another, and the 75% is of one vCPU, which isn't the same physical CPU all along.
-
@olivierlambert
So, 75% of one core is 75% of one core, but the time-resolution of the graph and the rotation over the physical cores makes this "hidden"? -
- The graph is doing average for the last 5 seconds
- You are presuming there's a perfect mapping between 1x vCPU and 1x physical CPU. Xen could schedule one vCPU into various physical CPUs. Likely, one of your vCPU load is spread on more physical CPUs.
Remember: for Xen, your whole VM is like a process. It will be scheduled on "real" CPUs in a way that might be not "what you see" from the guest.