• Do not disable page sharing or the balloon driver. As described, page sharing is a lightweight technique which opportunistically reclaims the redundant host memory with trivial performance impact. In the cases where hosts are heavily overcommitted, using ballooning is generally more efficient and safer compared to using hypervisor swapping, based on the results presented in Section 5.3. These two techniques are enabled by default in ESX4 and should not be disabled unless the benefits of doing so clearly outweigh the costs.
• Carefully specify the memory limit and memory reservation. The virtual machine memory allocation target is subject to the limit and reservation. If these two parameters are misconfigured, users may observe ballooning or swapping even when the host has plenty of free memory. For example, a virtual machine’s memory may be reclaimed when the specified limit is too small or when other virtual machines reserve too much host memory, even though they may only use a small portion of the reserved memory. If a performance-critical virtual machine needs a guaranteed memory allocation, the reservation needs to be specified carefully because it may impact other virtual machines.
• Host memory size should be larger than guest memory usage. For example, it is unwise to run a virtual machine with a 2GB working set size in a host with only 1GB host memory. If this is the case, the hypervisor has to reclaim the virtual machine’s active memory through ballooning or hypervisor swapping, which will lead to potentially serious virtual machine performance degradation.
Although it is difficult to tell whether the host memory is large enough to hold all of the virtual machine’s working sets, the bottom line is that the host memory should not be excessively overcommitted making the guests have to continuously page out guest physical memory.
• Use shares to adjust relative priorities when memory is overcommitted. If the host’s memory is overcommitted and the virtual machine’s allocated host memory is too small to achieve a reasonable performance, the user can adjust the virtual machine’s shares to escalate the relative priority of the virtual machine so that the hypervisor will allocate more host memory for that virtual machine.
• Set appropriate Virtual Machine memory size. The virtual machine memory size should be slightly larger than the average guest memory usage. The extra memory will accommodate workload spikes in the virtual machine. Note that guest operating system only recognizes the specified virtual machine memory size. If the virtual machine memory size is too small, guest-level paging is inevitable, even though the host may have plenty of free memory. Instead, the user may conservatively set a very large virtual machine memory size, which is fine in terms of virtual machine performance, but more virtual machine memory means that more overhead memory needs to be reserved for the virtual machine.