[libvirt-users] Running all my virtual machines with a low priority

Daniel P. Berrangé berrange at redhat.com
Thu May 2 09:43:04 UTC 2019


On Thu, May 02, 2019 at 11:33:06AM +0200, Martin Kletzander wrote:
> On Wed, May 01, 2019 at 11:58:23AM +0200, R. Diez wrote:
> > 
> > > You would have to set the priority of all vCPUs in each guest, as well
> > > as emulator threads in each guest (the latter needs very new libvirt).
> > 
> > This does not seem a viable option then with Ubuntu 18.04. And changing XML on all guest VMs is extra work.
> > 
> > Is there no other way? For example, are all such virtual machines not some daemon or systemd unit or set of units? Would it be feasible to lower the
> > priority on all of those? Or is that not easy to do either?
> > 
> 
> I'm not sure if we're resetting all the cgroup values, so it should be possible
> by setting this for the machine.slice cgroup (or somewhere around there) which
> would make it effective for all the VMs, right?  I have not tested it, though,
> sorry.

You could perhaps set  'cpu.shares' cgroup setting on /machine.slice.
This isn't really a nice level in the traditional sense, rather it is
a relative weighting evaluated against other cgroups at the same level.
So if you change it from 1024 to 512, then processes under /machine.slice
will get 1/2 the CPU time vs stuff under /system.slice or /user.slice,
when there is contention for CPU time. 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list