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:
- 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.)
- For each ESX host in the cluster, configure the SWAP to point to the SWAP data store.
- 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.
- 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.
- 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!
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”.
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
Any suggestions on the storage characteristics for the swap data store.
For example:
RAID type?
IOPS?
Size?
Thanks
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.