KSM
Redirect to:
Outdated, see Dynamic Memory Management
Introduction
Beginning with Proxmox VE 1.5 (only with Kernel 2.6.35 and higher), Proxmox VE uses KSM (Kernel Samepage Merging). Since Proxmox VE 1.9, it also works with the default 2.6.32 Kernel branch.
KSM is running in the Linux kernel scanning the memory of all the virtual machines running on a single host, looking for duplication and consolidating. With KSM we're able to improve virtual machine density by as much as 300% without impacting performance. One of the great benefits of using Linux as the hypervisor means KSM is not limited to KVM and virtual machines, but can also reduce memory pressure with normal Linux applications.
Howto enable KSM
Just run the 2.6.32 kernel branch, see Proxmox_VE_Kernel
Check packages version with pveversion -v (all versions should be equal or higher):
pveversion -v pve-manager: 1.9-24 (pve-manager/1.9/6542) running kernel: 2.6.32-6-pve proxmox-ve-2.6.32: 1.9-43 pve-kernel-2.6.32-6-pve: 2.6.32-43 qemu-server: 1.1-32 pve-firmware: 1.0-13 libpve-storage-perl: 1.0-19 vncterm: 0.9-2 vzctl: 3.0.28-1pve5 vzdump: 1.2-15 vzprocps: 2.0.11-2 vzquota: 3.0.11-1 pve-qemu-kvm: 0.15.0-1 ksm-control-daemon: 1.0-6
KSM in action
Just install several KVM virtual machines with the same OS (using at least 80% of your physical memory on the host) and wait a few minutes. you will notice higher CPU activities on the host (ksm daemon) and the used memory on the host will be lowered significantly (see start page showing the overall memory usage).
Howto verify that KSM is working (how many pages are being shared between your KVM guests):
watch cat /sys/kernel/mm/ksm/pages_sharing
Note: a page is 4096 bytes