VMware Cloud Community
JDizzle84
Contributor
Contributor

Virtual machine swap file location.

I inherited a 6 node VMware cluster at the company I am at now. We currently are running 6 PowerEdge R710 servers from Dell. 4 of them have ESX 4.0 and the other 2 have ESXi 4.1. We just took delivery of a Cisco Blade Chassis, so Im configuring the blades and came accross the Virtual Machine Swapfile Location setting. On our current 6 Dell servers, each host has a NFS datastore from our SAN caled "VMSWAP" set for the swapfile location. From what I have read, chosing this option can be benificial for troubleshooting if you are having performance issues on the host or in the guest os, even though I am not quite sure how. My question is, what is the best practice? Should I store the swapfiles with the virtual machines and only change it if I am having an issue? Is there a performance impact on vMotion by having a centralized datastore specified as a swapfile location? Any other "gotcha's" that would come from doing it this way?

Tags (1)
0 Kudos
4 Replies
weinstein5
Immortal
Immortal

Welcome to the Community - By default the swapfile is created in the same directory as the VMs configuration file (VMX) - you can change the default location which sounds like your predecessor had configured - the biggest caveat in doing this is to make sure that the swap file location is accessible by any host that you will want to vmotion to - There is not so much of a performance gain or hit but it might be easier to manage to insure there is enough space for the swapfile - the swapffile is created at startup of the VM and if there is not anough space on the disk the VM will not start

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
JDizzle84
Contributor
Contributor

Thanks for the help. That is what I thought, but just wanted the security of a second expert opinion! Smiley Wink

0 Kudos
VirtuallyMikeB

Good day!

It sounds like your environment is growing.  Another design option to consider when determining the .vswp file location is whether or not you're replicating logical storage units (volumes, LUNs, etc.) for disaster recovery (DR) or backup purposes.  Because the size of .vswp files are equal to the amount of unreserved memory allocated to a VM, they tend to be several GB in size.  If you have very many VMs powered on at the same time, .vswp files can take up tens of GB or more.  If you're keeping .vswp files in the same datastore as your .vmdks, these can eat up a lot of otherwise usable space.  In this situation, then, if you're replicating LUNs that store your VMs, you're also replicating their .vswp files (provided they're powered on during the replication).

Many DR solutions replicate over a low bandwidth WAN link, in which case, preserving bandwidth is likely important.  This is why storage vendors will build into their replication products differential copying, such that after a baseline copy of all data in a LUN, subsequent transfers only copy the changed data blocks, thereby saving valuable WAN bandwidth.

When you separate out your .vswp files into their own volume/LUN/datastore, you can then manage them separately from storage that keeps your .vmdks, and prevent .vswp files from being needlessly replicated and backed up over WAN links.  Similar reasoning suggests you should keep your guest OS paging and swap .vmdks on a separate LUNs, as well.

Cheers,

Mike Brown

http://VirtuallyMikeBrown.com

https://twitter.com/#!/VirtuallyMikeB

http://LinkedIn.com/in/michaelbbrown

----------------------------------------- Please consider marking this answer "correct" or "helpful" if you found it useful (you'll get points too). Mike Brown VMware, Cisco Data Center, and NetApp dude Sr. Systems Engineer michael.b.brown3@gmail.com Twitter: @VirtuallyMikeB Blog: http://VirtuallyMikeBrown.com LinkedIn: http://LinkedIn.com/in/michaelbbrown
0 Kudos
im3L79
Contributor
Contributor

What is the best practise to keep the swap files ?

VM Clustering recommends that the virtual machine swapfiles are to be stored in the same directory as the virtual machines.

I put my virtual machine on a shared storage, and so are their swapfiles.

Is this the best practice ?

0 Kudos