[libvirt-users] Hard limit for the cpu usage of a VM

Eric Blake eblake at redhat.com
Mon Oct 24 20:20:50 UTC 2011


On 10/24/2011 01:50 PM, sethuraman subbiah wrote:
> Hi ,
>
> I was previously using xen and currently moved to KVM. I am using libvirt to manage these VMs. In den's credit scheduler , I had the ability to set a cap on the cpu usage for a VM. But I was not able to find a similar substitute in KVM. I find that we can use cgroups to provide shares for VM but that will be more like weight based and it doesn't set a hard cap for that VM. I tried using cpulimit but I find it inaccurate and we can give values only between 0-100. Thus, I think it cannot support multi core environments. Can any one suggest a method to set a hard limit on a VM's cpu usage? Thank you.

Libvirt 0.9.4 added CPU bandwidth limitation support, via <cputune>: 
http://libvirt.org/formatdomain.html#elementsCPUTuning.  <period> and 
<quota> map to hard-coded caps via cgroups, nicer than the weighted 
numbers via <shares>.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvirt-users mailing list