KVM with 1 vCPU has CPU load above 1
I have a KVM running with 1 vCPU on a machine with 4 cores.
lscpu
in the KVM gives me 1 CPU with 1 core :
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 43 bits physical, 48 bits virtual
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 13
Model name: QEMU Virtual CPU version 2.5+
Stepping: 3
CPU MHz: 2300.000
BogoMIPS: 4600.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32 KiB
L1i cache: 32 KiB
L2 cache: 4 MiB
L3 cache: 16 MiB
NUMA node0 CPU(s): 0
Vulnerability Itlb multihit: KVM: Vulnerable
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Full generic retpoline, STIBP disabled, RSB filling
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl xtopology cpuid tsc_known_freq pni cx16
x2apic hypervisor lahf_lm cpuid_fault pti
But when I run top
in the KVM, the load average sometimes go above 2 or 3 as if my KVM had more than 1 core. Why is that ? Is there a way to correct the load displayed by top so that it's coherent with the 1 vCPU of the KVM ?
Solution 1:
Load average is proportional to the number of tasks running or ready to run. It does not reflect the number of CPUs.
Indirectly, you can use this to calculate a utilization metric. What the ratio of load average to CPUs means is workload dependent. Some compute heavily applications will have poor response time when this exceeds 1. Others can tolerate a bit higher. Hosts under extreme conditions can get to tens or more without completely seizing up.