Page 1 of 1

CPU usage of a VM that runs Ubuntu

Posted: Fri Jan 26, 2018 5:37 am
by z0rr0
Hello everyone, I am interested to measure the CPU usage of different OSs running as QEMU guests. To do so, I run the VM and then check the CPU usage of the process named "qemu" by using TOP. I did it for Ubuntu with an Apache server and I saw that the CPU usage is always more or less 10%. This value changes if I produces traffic to the Apache server. My question is how does linux ubuntu achieve to keep the CPU usage at 10% all the time? May this be related with the use of CPU scaling? As I said before, it is at 10% even when it is idle. To increment the cpu usage, I have to incress the number of http request at 100 in a windows of 60s.

Regards, Matias.

Re: CPU usage of a VM that runs Ubuntu

Posted: Sun Jan 28, 2018 12:10 am
by pragmatic
You question is somewhat ambiguous with respect to exactly what you are trying to ask. To me it would seem that 10% CPU is the nominal usage for that OS running in QEMU. In other words, it is taking 10% of our CPU resources just to keep the Ubuntu instance running, perhaps even at idle as you say. Then you cause traffic to route to the VM thereby demanding more CPU resources and the 10% base will increase as necessary.

Re: CPU usage of a VM that runs Ubuntu

Posted: Sun Jan 28, 2018 4:46 am
by Korona
Your benchmark cannot properly distinguish CPU usage caused by the guest (i.e. the guest kernel and daemons running inside the guest) and QEMU (e.g. time keeping IRQs, VMENTER/VMEXIT costs, QEMU own event loop and so on).

Re: CPU usage of a VM that runs Ubuntu

Posted: Sun Jan 28, 2018 1:45 pm
by z0rr0
Hello,
pragmatic wrote:You question is somewhat ambiguous with respect to exactly what you are trying to ask. To me it would seem that 10% CPU is the nominal usage for that OS running in QEMU. In other words, it is taking 10% of our CPU resources just to keep the Ubuntu instance running, perhaps even at idle as you say. Then you cause traffic to route to the VM thereby demanding more CPU resources and the 10% base will increase as necessary.
You are right, let me rephrase. I am interested to know how the Ubuntu guest is able to keep the CPU at 10%.
Korona wrote:Your benchmark cannot properly distinguish CPU usage caused by the guest (i.e. the guest kernel and daemons running inside the guest) and QEMU (e.g. time keeping IRQs, VMENTER/VMEXIT costs, QEMU own event loop and so on).


In my benchmark, I am interested to consider both: the guest and QEMU.

Thanks for your answers, Matias.

Re: CPU usage of a VM that runs Ubuntu

Posted: Mon Jan 29, 2018 10:07 am
by z0rr0
I think what I really wanted to ask was about P-state. I knew nothing about this but it seems that Intel manual is quite complete :)