CPU used in VM

BoolyTran

New Member
Apr 18, 2017
21
0
1
32
Dear all,

Currently, I have a question about CPU used in VM, i have one VM with option 1 core 1 socket however i ussally monitor on sumary of VM then noticed VM can run high 100% on 1 CPU and CPU usage 100.98% or 102%.

So, Is there a way for me edit fixed CPU only run <= 100%.

Please give me idea.

Thanks and Regards.
 
qemu always has a little bit overhead for the cpu, but you can add an additional "CPU Limit" under Hardware->CPU Options
set it to how many cores you have (e.g. 2 sockets, 4 cores => cpu limit = 8) and then the qemu overhead should be accounted for in the limit

note that with this approach, the guest can possibly not use 100% of the core (to give way to the qemu overhead)
 
  • Like
Reactions: BoolyTran
Dear dcsapak,

In case VM have 2 cpu 1 core, i add CPU limit are 2, this mean VM not used > 2 cpu, that right ?
 
In case VM have 2 cpu 1 core, i add CPU limit are 2, this mean VM not used > 2 cpu, that right ?
yes but to clarify further:

a guest cannot use more than the configured limits (even without cpulimit), but the qemu process has (a little) overhead (e.g. accessing storage, network, etc)
with cpu limit in place, the sum of guest cpu + qemu overhead cannot exceed the cpu limit, the guest may not be able to use the configured cpus fully