CPU usage of KVM

9,492

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.

Share:
9,492

Related videos on Youtube

michas
Author by

michas

Updated on September 18, 2022

Comments

  • michas
    michas over 1 year

    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?

    • Admin
      Admin almost 11 years
      Which Linux distros are you using? Debian, Ubuntu, CentOS or something else?
  • michas
    michas almost 11 years
    There are only linux guests in my case. (question updated)
  • Hauke Laging
    Hauke Laging almost 11 years
    @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_clockso‌​urce?
  • michas
    michas almost 11 years
    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.
  • Hauke Laging
    Hauke Laging almost 11 years
    @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.
  • michas
    michas almost 11 years
    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
    michas almost 11 years
    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...