Virtual Machine Memory Overhead
Windows virtual machines require more memory with each passing release and software demands on memory are becoming larger all the time. In a vitual environment it is quite simple to increase the amount of virtual memory granted to a virtual machine, especially with features such as hot add. The ability to dynamically increase the amount of memory available to the virtual machine whilst it is still turned on.
Hot add has a few requirements.
From a licensing point of view you need vSphere Advanced, Enterprise or Enterprise plus as a minimum.
The chart below illustrates the Windows Operating Systems that support Hot Add.
* Server must be rebooted for memory to be registered in Windows.
Adding additional RAM to a virtual machine is so easy these days that it is important to not over look the effects that increasing the virtual machine memory can cause on the host and the virtual machine datastore.
Every Gigabyte of virtual machine memory demands more memory overhead from the ESX host. The overhead on the host is illustrated in the table below.
As you can see, the total amount of RAM the hosts requires to power your virtual machines and future ones can increase dramatically when you start adding more RAM to your virtual machines, especially when adding more vCPU’s. This is also true with the multi-cored vCPU in vSphere 4.1, as explained by Jason Boche.
To put this into perspective, if you have a host with ESX installed with two virtual machine running 2 VCPUs and 4GB RAM each you would need to allow 10.1GB RAM as a minimum.
1.6GB (ESX)+ 4GB (VM1)+ 242.51MB (Overhead VM1)+4GB (VM2)+ 242.51MB (Overhead VM2)=10.1GB
Depending on the load on the virtual machines, they may require up to the full 4GB assigned to them, this leaves no additional memory available. This is not something I would recommend. I would instead assign at least 12GB to this configuration, more likely more so that there is room for expansion at a later date, or adding additional virtual machines.
Storage is another consideration when upping the amount of virtual machine memory. The virtual machine swap file, .vswp, is equal to the size of the virtual machine RAM installed. Ensure this is taken into account when thinking about what size datastore is required to store the virtual machines. The alternative is to specify a seperate, fast access datastore for storing the virtual machine swap file. If possible use SSD drives.
This can be set by following the instructions for Storing a virtual machine swap file in a location other than the default on the VMware website.
With careful planning, running out of memory or storage should never happen if you follow VMware best practices for creating virtual machines. More information can be found in the vSphere 4.1 Performance Best Practices guide.
Additional information on VMFS datastore storage allocation can be found here