Hardware

Remove virtual machine swap space on disk

VMware vSphere virtual machines have a number of memory management technologies, including hypervisor swapping. Learn how to remove the swap file for a VM.

The use case is rare, but it may be necessary to not utilize a virtual swap file for VMware vSphere virtual machines.

Each virtual machine in vSphere is subject to a number of memory management technologies, which include the balloon driver through VMware Tools, transparent page sharing on the host, memory compression, and hypervisor swapping. (The technologies are in order of most desirable to least desirable features.) The hypervisor swapping function makes the virtual machine's memory inventory run on disk instead of addressable space in the host's RAM inventory.

A virtual machine creates a swap file on disk; this is separate to anything that may be configured in the operating system, such as a Windows page file on the guest virtual machine. This swap file (Figure A) is equal to the memory allocation on the virtual machine. Figure A

Click the image to enlarge.

This particular virtual machine only has 4 MB of memory (it is a low-performance test system), but the 4 MB of RAM is also represented on the VMFS datastore (LUN-RICKATRON-1) as a .vswp file. While the 4 MB for this virtual machine is not too impactful on most storage systems, larger virtual machine memory provisions can chew up datastore space and (hopefully) never be used.

If you don't want to have this .vswp file on the storage at all, there is one way to prevent the virtual machine from representing the physical memory allocation on disk. Using a memory resource reservation for the entire amount of memory for the virtual machine would not allow it to power-on unless the host can provide, exclusively, the reserved amount of memory. In that situation, the guest would never result to swapping (Figure B). Figure B

Click the image to enlarge.

Once the reservation is made, the next time the virtual machine is powered on, it will not claim the .vswp file on the datastore.

Note: This configuration should be used in very specific situations, such as a tier 1 application that you will forgo the benefits of VMware memory management to ensure the absolute highest performance.

Have you used full reservations to disable swapping? If so, share your reasons why in the discussion.

About

Rick Vanover is a software strategy specialist for Veeam Software, based in Columbus, Ohio. Rick has years of IT experience and focuses on virtualization, Windows-based server administration, and system hardware.

0 comments

Editor's Picks