What is the recommended size of swap space on the KVM host node?
Note: Configuring and monitoring an amount of SWAP space on the node as an administrative task that should be handled by the server administrator. You can search for best practices over the Internet and apply them on your own responsibility.
The size of swap on the KVM host node depends on the number of the virtual servers because qemu-kvm processes will use swap memory along with the active RAM memory.
In general, it depends on the amount of the RAM on the node:
|Amount of RAM on the server
|Recommended amount of SWAP
|4GB or less
|4GB - 16GB
|16GB - 64GB
|64GB - 256GB
Due to the fact that SWAP stores inactive memory you can monitor and check the amount of the inactive memory as below during some extended time period:
# cat /proc/meminfo | grep -i inact
Inactive: 2703480 kB
Inactive(anon): 1441228 kB
Inactive(file): 1262252 kB
Make sure that amount of swap memory is at least equal to the maximum amount of inactive memory in the output above