Installation guide

Chapter 20. Overcommitting with KVM
162
Configuring swap for overcommitting memory
The swap partition is used for swapping underused memory to the hard drive to speed up memory
performance. The default size of the swap partition is calculated from the physical RAM of the host.
Red Hat Knowledgebase
1
has an article on safely and efficiently determining the size of the swap
partition.
The swap partition must be large enough to provide virtual memory for all guests and the host system.
Important
The example below is provided as a guide for configuring swap only. The settings listed may not
be appropriate for your environment.
Example 20.1. Memory overcommit example
ExampleServer1 has 32GB of RAM. The system is being configured to run 56 guests with 1GB of
virtualized memory. The host system rarely uses more than 4GB of memory for system processes,
drivers and storage caching.
32GB minus 4GB for the host leaves 28GB of physical RAM for virtualized guests. Each guest uses
1GB of RAM, a total of 56GB of virtual RAM is required for the guests.
The Red Hat Knowledgebase recommends 8GB of swap for a system with 32GB of RAM. To safely
overcommit memory there must be sufficient virtual memory for all guests and the host. The host
has 28GB of RAM for guests (which need 56GB of RAM). Therefore, the system needs at least
28GB of swap for the guests.
ExampleServer1 requires at least 36GB (8GB for the host and 28GB for the guests) of swap to
safely overcommit for all 56 guests.
It is possible to overcommit memory over ten times the amount of physical RAM in the system. This
only works with certain types of guest, for example, desktop virtualization with minimal intensive usage
or running several identical guests with KSM. Configuring swap and memory overcommit is not a
formula, each environment and setup is different. Your environment must be tested and customized to
ensure stability and performance.
For more information on KSM and overcommitting, refer to Chapter 21, KSM.
Overcommitting virtualized CPUs
The KVM hypervisor supports overcommitting virtualized CPUs. Virtualized CPUs can be
overcommitted as far as load limits of virtualized guests allow. Use caution when overcommitting
VCPUs as loads near 100% may cause dropped requests or unusable response times.
Virtualized CPUs are overcommitted best when each virtualized guest only has a single VCPU. The
Linux scheduler is very efficient with this type of load. KVM should safely support guests with loads
under 100% at a ratio of five VCPUs. Overcommitting single VCPU virtualized guests is not an issue.
You cannot overcommit symmetric multiprocessing guests on more than the physical number of
processing cores. For example a guest with four VCPUs should not be run on a host with a dual
1
http://kbase.redhat.com/faq/docs/DOC-15252