VM Host -> Xenon E5-2440 w/ 48G mem… Everything runs CentOS6.5 (2.6.32-431)
I have 4 guest VMs running each w/ 2G of memory. Their disk images are local files.
The host machine is also running a lightly used NFS server but not much else. (swappiness=0) After a day or so as the buffer cache grows to nearly 40G some of these VMs wind up nearly fully swapped to disk. (viewed via: grep VmSwap /proc/PID/status)
The problem I'm having is while these VMs may not be regularly used they have to be at the ready. However in practice they are being swapped out causing serious issues with their response time.
I'm certainly all for having my guest VMs use a reasonable sized swap file and let the OS decide the balance between buffer cache & swap but this doesn't seem to be working for the host machine in my use case.
Any option to keep the VMs responsiveness from being degraded besides disabling swap on the host machine? Attempt with cgroups or just pull the plug on the swap file for this use case?
Best Answer
You can lock the pages into memory in later versions of libvirt:-
http://libvirt.org/formatdomain.html#elementsMemoryBacking
Careful: This doesn't appear when using Fedora 19 as a hypervisor, nevertheless according to the changelog for the latest RPM (I can find) for EL6.5 libvirt this exists;