This section describes ways to avoid or reduce host-level swapping, and presents techniques to minimize its impact on performance when it is unavoidable.

As described in Memory Overcommit Techniques, VMware Cloud on AWS supports a bounded amount of memory overcommitment without host-level swapping. If the overcommitment is so large that the other memory reclamation techniques are not sufficient, however, VMware Cloud on AWS uses host-level memory swapping, with a potentially significant impact on virtual machine performance.

  • Because VMware Cloud on AWS uses page sharing, ballooning, and memory compression to reduce the need for host-level memory swapping, don’t deactivate these techniques.

  • If you choose to overcommit memory with VMware Cloud on AWS, be sure you have sufficient swap space on your hosts. At the time a virtual machine is first powered on, VMware Cloud on AWS creates a swap file for that virtual machine 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 (plus the space required for VMX swap, as described in Memory Overhead).

    Note that in VMware Cloud, swap files inherit the storage policy associated with the VM, and are thus thin-provisioned by default. If left at the default value, this swap file will start out having slightly reduced performance, but will reach full performance once it is fully utilized.

  • The swap file location for a specific virtual machine can be set in the vSphere Client (right-click the virtual machine, select Edit Settings, choose the VM Options tab, expand Advanced, and select a Swap file location). If this option is not set, the default behavior is that the swap file will be created in the virtual machine’s working directory.

  • Host-level memory swapping can, in many cases, be reduced for a specific virtual machine by reserving memory for that virtual machine at least equal in size to the machine’s active working set. Host-level memory swapping can be eliminated for a specific virtual machine by reserving memory equal in size to the virtual machine’s entire memory.

    Note:

    When applied to a running virtual machine, the effect of these memory reservations might appear only gradually. To immediately see the full effect you would need to power-cycle the virtual machine.

    Be aware, however, that configuring resource reservations will reduce the number of virtual machines that can be run on a system. This is because VMware Cloud on AWS will keep available enough host memory to fulfill all reservations (both for virtual machines and for overhead) and won't power-on a virtual machine if doing so would reduce the available memory to less than the reserved amount.

    Note:

    The memory reservation is a guaranteed lower bound on the amount of physical memory VMware Cloud on AWS reserves for the virtual machine. It can be configured through the vSphere Client in the settings window for each virtual machine (right-click the virtual machine, select Edit Settings, choose the Virtual Hardware tab, expand Memory, then set the desired reservation).