8

I have a linux host with 4 KVM linux guests. All the guest are pretty much idle, having a load of <0.1 inside the guest.

Now, if I do a top on the host, each KVM process is using something about 30% of the CPU.

Is this a normal behavior? I would expect the host to need much less CPU just to host a idle guest.

If it is normal, what is the reason for this?

If it is not normal, what might be the problem?

  • Which Linux distros are you using? Debian, Ubuntu, CentOS or something else? – slm May 13 '13 at 5:17
  • The host is running a current fedora the guests an older SLES 11.2. Kernel is 3.6.10-4.fc18.x86_64 on the host and 3.0.13-0.27-default on the guest. – michas May 13 '13 at 6:16
5

Being cynical I could say that is "normal" for Windows guests but not for Linux guests (at least I never saw one behave like that).

With Windows it depends a lot on the applications running (near idle). A plain XP or W2K (I have no experience with newer versions in KVM yet) causes 10% to 20% on the host (being shown about 0% within) but MS SQL server gets this easily above 30%. This seems to be related to timer access and / or ACPI somehow. But even in a non-ACPI VM I never got Windows below 10% on the host.

Edit 1 (integrating comments)

What is the output of cat /sys/devices/system/clocksource/clocksource0/current_clocksource (in the guest)? That should be kvm-clock. Check your kernel config (/proc/config.gz) for CONFIG_PARAVIRT_CLOCK and CONFIG_KVM_CLOCK.

This is a list of kernel config options relevant to KVM.

  • There are only linux guests in my case. (question updated) – michas May 12 '13 at 17:51
  • 2
    @michas Oh boy, you ruined my beloved prejudice... Are that text mode VMs or do they have X? What is the output of cat /sys/devices/system/clocksource/clocksource0/current_clocksource? – Hauke Laging May 12 '13 at 17:56
  • current_clocksource is acpi_pm in the guest and tsc on the host. No X but a java application server and an oracle DB is running in each guest. – michas May 12 '13 at 18:14
  • @michas That should be kvm-clock instead (in the guest). I never had to configure that explicitely. Check your kernel config (/proc/config.gz) for CONFIG_PARAVIRT_CLOCK and CONFIG_KVM_CLOCK. – Hauke Laging May 12 '13 at 18:38
  • 1
    Both are set to y. Setting current_clocksource to kvm-clock makes things better. Now each KVM process is around 20 percent. The system was migrated to KVM from a previous virtualbox setup. Seems like some setting are still from the old setup... – michas May 12 '13 at 19:57
0

I would check to make sure that the KVM guests are provisioned so that they're able to make use of all the host's resources (CPU, RAM, etc.). Typically KVM guests are only allocated say 1-2 CPUs (cores) on a system that may contain many more.

This would mean you're not comparing the exact same thing when looking at the host's resources vs. the internals of a given KVM guest.

For example

The host has the following:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                12
On-line CPU(s) list:   0-11
Thread(s) per core:    2
Core(s) per socket:    6
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               1200.000
BogoMIPS:              6404.04
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0-11

While one of the KVM guests has this:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 6
Stepping:              3
CPU MHz:               3202.024
BogoMIPS:              6404.04
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0
  • 1
    Similar here: 8 cores on the host and 4 cores on each guest. - But I don't see, how that results in substantial load out of an idle guest. – michas May 12 '13 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.