CPU usage of KVM
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.
Related videos on Youtube
michas
Updated on September 18, 2022Comments
-
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 almost 11 yearsWhich Linux distros are you using? Debian, Ubuntu, CentOS or something else?
-
-
michas almost 11 yearsThere are only linux guests in my case. (question updated)
-
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_clocksource
? -
michas almost 11 yearscurrent_clocksource is
acpi_pm
in the guest andtsc
on the host. No X but a java application server and an oracle DB is running in each guest. -
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
) forCONFIG_PARAVIRT_CLOCK
andCONFIG_KVM_CLOCK
. -
michas almost 11 yearsSimilar 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 almost 11 yearsBoth are set to
y
. Setting current_clocksource tokvm-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...