VMware Cloud Community
NEERAJSHARMA201
Contributor
Contributor

Best practice for VMswap file storage placement

We have query regarding the VMswap file storage placement.

1.       Is it possible to store the VMswap(.vswp) file at different location apart from default location?

2.       If yes, can we store different Vmswap(.vswp) on different data stores?

3.       What are advantages & disadvantages of this configuration?

4.       What will happen if we will place .vswp of all vm on single nfs data store (remote data store)

0 Kudos
4 Replies
mirceaflorin
Contributor
Contributor

Hi,

  Yes, it is possible . If your hosts are managed by a vCenter and are in a cluster, then first you have to set the policy "Store the swap file in a datastore specified by the host" by following the steps : Edit settings on the cluster-> Swapfile location . Now, go on the hosts at Configurations and specify the datastore where you want the swapfile to be held . More information at : http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100408...

  Regarding advantages : Let's assume you have disaster recovery configured for your VMs. This is done by Storage replication in another site. Then it would be clear that you don't want also the swapfile to be replicated, so you would keep your swapfile on a different datastore that is not replicated. Also for some backup solutions at storage level. Or your datastores are running on SSD ==> more infos on  : http://imallvirtual.com/?p=393 .

One disadvantage that comes in mind would be in case of a vMotion, if the host were you are migrating the VM has no access to the "swapfile datastore" , then it has to recreate the swapfile . Which would not be a problem for a small VM . But if you have a big VM, it would add time to completing the vMotion .

Hope I was of some help.

Kind regards,

Mircea

0 Kudos
zXi_Gamer
Virtuoso
Virtuoso

Best practice as per my idea is that there should not be any swap operations. Ideally, swapping is a costly operation and offloading to different FC lun or a NAS would add up to the bottlenecks in case of heavy load VMS.

Having said that, if you want to have a better performance with swapping, then I would suggest swapping on SSD disks Smiley Happy

SSD as Host Cache or Virtual Machine Swap File or both?

0 Kudos
john23
Commander
Commander

Most of the part already answered by   and zXi_Gamer

What will happen if we will place .vswp of all vm on single nfs data store (remote data store)?

You can keep all vms vswp on single nfs. While configuring across host (means vmotion), keep that nfs volume shared.

vswp file size is equivalent to the sizeof memory assigned to the virtual machine (in case of no reservation). In case of high memory operations, you may see the timed out while doing the vmotion.

-A

Thanks -A Read my blogs: www.openwriteup.com
0 Kudos
admin
Immortal
Immortal

Moving the swap file to an alternate datastore is a useful troubleshooting step if the virtual machine or guest operating system is experiencing failures, including STOP errors, read-only file systems, and severe performance degradation issues during periods of high I/O. However, identifying and resolving the underlying overcommit or storage performance issues is still recommended to ensure environment stability.

This can also be used to store the virtual machine swap files in an alternate non-replicated datastore when using LUN snapshot technologies to ensure that you are storing the swap files in a location that is not being replicated.

ESXi/ESX 3.5, 4.x, and ESXi 5.x


Note: If your hosts are part of an HA Cluster, you must change the cluster settings for virtual machine swap file location prior to executing the steps below. For more information, see the Change the Swap File Location section in the Virtual Machine Admin Guide for your version.

To edit the virtual machine swap file location in ESXi/ESX 3.5, 4.x, and ESXi 5.x:

  1. Connect directly to your host or to your vCenter Server using the VMware Infrastructure/vSphere Client.
  2. Click the Configuration tab for the ESXi/ESX host.
  3. Click Virtual Machine Swapfile Location and click Edit.
  4. Specify the datastore where you want to store the virtual machine swap files.
  5. After restarting your virtual machines, ensure the swap file is located on the specified host datastore.

To change the swap file location for a single virtual machine:

  1. Power off the virtual machine.
  2. Unregister the virtual machine. Right-click the virtual machine in the Inventory and choose Remove from Inventory.
  3. Connect to the host:

  4. Change directory to the folder where the virtual machine resides:

    cd /vmfs/volumes/datastore_name/virtual_machine_folder/

  5. Edit the virtual machine's configuration file with a text editor.
  6. Add this line:

    sched.swap.dir = /vmfs/volumes/datastore/

  7. Register the virtual machine again. For more information, see Registering or adding a virtual machine to the inventory on vCenter Server or on an ESXi/ESX host (1....
0 Kudos