Unlike OpenVZ virtualization, KVM is a full virtualization product which means you cannot oversell KVM some resources as standard. KVM nodes can oversell on CPU resources but you can’t oversell the space or the memory usage. This can cause issues with your available resources. For example, if you create a virtual server with 100GB of space and 10GB of ram you will immediately notice 100GB of space is lost and 10GB of ram is also lost. This is quite wasteful because even though the new server will not be using 100GB of space or, anywhere near 10GB of ram those resources are no longer available for you to use.
Firstly, before we proceed you cannot oversell KVM space on KVM nodes, it’s just not possible. However, you can oversell memory by using a little program called KSM (kernel same-page merging). KSM was originally developed by Red Hat and it’s been included since Kernel version 2.6.32, as standard it’s not activated by default. You can save between 30% to 60% of your memory resources by activating this script. After an hour look at your resource usage and you should see a vast improvement in the resources that you have available to use.
To activate KSM login to the host node as the root user or, a user with root privilege’s and issue the below command to start KSM
To automatically start KSM on boot turn it on using the chkconfig script
chkconfig ksmtuned on
You can use other switches with this script. Just swap start for the one required.
It’s worth noting you can also use this on an OpenVZ / Virtuozzo node, the process is exactly the same just start the script.
How was this article?
More from Dedicated Servers
How To Configure FailOver IPs On your CentOS Dedicated Server On some dedicated services, First2Host uses Failover IP blocks and these …