VMware SWAP File Best Practice

VMware vm swap file diagram

Answering the question that always seems to get asked, “what is the best practice for the VMware SWAP file?”

I’ve put this method through bench testing and found it to have the best performance, step by step for VMware SWAP file configuration is:

  1. Set up a data store in each ESXi cluster for guest SWAP files, see diagram to the right. (Do not use local ESX disks! This will save more expensive SAN storage but causes latency for DRS and vMotioning of VMs.)
  2. For each ESX host in the cluster, configure the SWAP to point to the SWAP data store.
  3. Go through all the setting on each VM in the cluster and make sure VM SWAP file are controlled by the host, not in VM folder.
  4. Here’s a step that some will disagree on but my testing has found it to produce the best VM performance, log into the Windows VM and set the SWAP file to be maintained by Windows. Some admins like to do 2.5 – 3.5 ratio for the memory but this is not a physical so let Windows adjust the SWAP file size. From what I have found it’s a 1:1 ratio.
  5. Configure 1 – 3 the same for Linux but on 4 just let Let Linux do it’s own thing. Linux uses a SWAP volume which is stored in the VM’s folder.

VMware SWAP File Test Results My test results produced:  Faster VM Booting, Better VM Performace, Faster vMotioning and DRS, Faster VM evacuation when ESXi host is entering maintenance mode. In the end, the goal is to avoid slow VM performance.

Another useful VMinstall post on the SWAP file topic can be found at: ESX Swap File Size Best Practices.

More on VMware VM Swap file can be found in the: VMware Best Practice Guide.

Read more about “Virtualization

Your Turn:

Do you have a VMware SWAP file tip you want to share, please comment!

About 

I enjoy helping VMware Beginners and New IT Managers learn best practices, virtualization concepts, and cloud basics. Connect with me on LinkedIn.

Comments

  1. ChrisAug says

    I agree with the principle in regards to VM Swap files, but your title is named “Guest Swap File Best Practice”. This means the swap file for each individual guest VM (which is what I am looking for). So like I said, The best practice is correct, just change the title and remove the word “Guest”.

  2. says

    Chris,

    Good catch. This can be confussing. I have updated the post per your recommendation. Thx

    FYI, on something that may help you. I’ve heard and used 2 methods for best practices on the actual VM:

    1. Turn off the page file and allocate more memory as needed. Improves performance.

    2. On Windows, change to allow Windows to manage the swap file. Maximizes memory.

    Hope this helps!

    Joe

  3. Mike says

    Any suggestions on the storage characteristics for the swap data store.

    For example:
    RAID type?
    IOPS?
    Size?

    Thanks

  4. Mike says

    This article applies to VMKernel Swap files, not VM Guest swap files. What it says is correct, but you should change the title so it reflects what the article is taking about.

Now it's your turn...