Ubuntu – KVM Guest Shows High CPU Usage in Host but not in Guest

kvm-virtualizationUbuntuvirtualization

Host is Ubuntu 10.04 Server. 8 physical cores. Guest is Ubuntu 12.04; its allocated two CPU. I have other VMs, but the last few days I've run only this one guest.

Top inside the guest reports load from .05 – .20. Host sees this one kvm process 80-120% CPU, and maintains a total load of around 1-1.2. Host has no other workload than hosting guests.

This is not a problem with ksmd though I did have that problem and disabled ksmd after playing around with different values to no real satisfaction with the performance. Otherwise, the KVM settings are the default installed by the Ubuntu packages.

I installed this server fairly recently, and I have probably had this problem the entire time. At least, since I started running any regular workload on the guest.

Ideas?

Best Answer

It turns out that the guest was under-reporting its CPU usage. I ran this same workload on another guest entirely and it used CPU resources at about the same level as my KVM host was reporting. This was not an apples to apples comparisan but it was a meaningful result.

Then, I had my real breakthrough. I noticed that, for this one guest I was mistakenly using the virtual "SCSI" controller. I changed it to Virtio and two things happened: host CPU usage went down a little bit, and the guest CPU went up - it reported almost exactly the same as the host, like we'd expect.

Related Topic