Technical information

Performance Best Practices for VMware vSphere 4.0
24 VMware, Inc.
While ESX allows significant memory overcommitment, usually with little or no impact on performance,
you should avoid overcommitting memory to the point that it results in heavy memory reclamation.
If the memory savings provided by transparent page sharing reach their limit and the total memory
demands exceed the amount of machine memory in the system, ESX will need to use additional memory
reclamation techniques. As described above, ESX next uses ballooning to make memory available to
virtual machines that need it, typically with little performance impact. If still more reclamation is needed,
ESX uses host-level swapping, which can result in noticeable performance degradation.
If you suspect that memory overcommitment is beginning to affect the performance of a virtual machine
you can:
a Look at the value of Memory Balloon (Average) in the vSphere Client Performance Chart.
An absence of ballooning suggests that ESX is not under heavy memory pressure and thus memory
overcommitment is not affecting performance. (Note that some ballooning is quite normal and not
indicative of a problem.)
b Check for guest swap activity within that virtual machine.
This can indicate that ballooning might be starting to impact performance (though swap activity can
also be related to other issues entirely within the guest).
c Look at the value of Memory Swap Used (Average) in the vSphere Client Performance Chart.
Memory swapping at the host level would indicate more significant memory pressure.
Memory Swapping
As described in “Memory Overcommit Techniques,” when other memory reclamation techniques are not
sufficient, ESX uses memory swapping. This swapping occurs at the host level, and is distinct from the
swapping that can occur within the virtual machine under the control of the guest operating system.
This subsection describes ways to avoid or reduce host-level swapping, and presents techniques to reduce its
impact on performance when it is unavoidable.
Due to page sharing and other techniques (described above) ESX can handle a limited amount of memory
overcommitment without swapping. However, if the overcommitment is large enough to cause ESX to
swap, performance in the virtual machines is significantly reduced.
If you choose to overcommit memory with ESX, be sure you have sufficient swap space on your ESX
system. At the time a virtual machine is first powered on, ESX creates a swap file for that virtual machine
that is equal in size to the difference between the virtual machine's configured memory size and its
memory reservation. The available disk space must therefore be at least this large.
Swapping can be avoided in a specific virtual machine by using the vSphere Client to reserve memory for
that virtual machine at least equal in size to the machine’s active working set. Be aware, however, that
configuring resource reservations will reduce the number of virtual machines that can be run on a system.
This is because ESX will keep available enough host memory to fulfill all reservations and won't power-on
a virtual machine if doing so would reduce the available memory to less than the amount reserved.
If swapping cannot be avoided, placing the virtual machine’s swap file on a high speed/high bandwidth
storage system will result in the smallest performance impact. The swap file location can be set with the
sched.swap.dir option in the vSphere Client (select Edit virtual machine settings, choose the Options
tab, select Advanced, and click Configuration Parameters). If this option is not set, the swap file will be
created in the virtual machine’s working directory: either the directory specified by workingDir in the
virtual machine’s .vmx file, or, if this variable is not set, in the directory where the .vmx file is located. The
latter is the default behavior.
N
OTE The memory reservation is a guaranteed lower bound on the amount of physical memory ESX
reserves for the virtual machine. It can be configured through the vSphere Client in the settings window
for each virtual machine (select Edit virtual machine settings, choose the Resources tab, select Memory,
then set the desired reservation).