Businesses that have moved to virtualised machines need to ensure they have a regime in place to ensure their installations are running at optimised performance.
One way to gain a boost in performance is to move the swap file away from the default drive.
Moving the swap file to its own dedicated hard drive is one option to increase performance within any given virtual machine. However, as the swap file by its nature is only created when the available physical memory of the server is restricted, IT managers can optimise their servers by installing more memory.
As storage is low cost, this is an easy win for IT managers tasked with improving the performance of their servers. A good example of the possible memory expansion includes the moves by Dell to offer SSD storage on some of its PowerEdge servers.
VMware states: "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."
Before any changes are made to the location of the swap file it is advisable to read the appropriate guidance in the Virtual Machine Admin Guide [https://www.vmware.com/support/pubs/].
As all ESX/ESXi hosts will only power on their virtual machines when they can create a swap file, it is vital that any changes to its location are carried out correctly.
In addition, system adminstrators should check that there is enough space for the swap file to be created on any host that vMotion can access.
The management of the swap file must be carefully assessed and decisions made whether this should be located with the configuration file (set up by default) or moved to another location. VMware has best practice guidance that includes this advice:
"If swapping cannot be avoided, placing the virtual machine's swap file on a high-speed high bandwidth storage system will result in the smallest performance impact. The swap file location can be set with the sched.swap.dir option in the vSphere Client (select Edit virtual machine settings, choose the Options tab, select Advanced, and click Configuration Parameters).
"If this option is not set, the swap file will be created in the virtual machine's working directory: either the directory specified by workingDir in the virtual machine's .vmx file, or, if this variable is not set, in the directory where the .vmx file is located. The latter is the default behaviour."
Clearly a decision has to be made whether moving the swap file to its own dedicated memory will offer any performance boost.
For servers with limited memory resources this move could offer an advantage, but it's not a long term solution. This would make a priority of more installed memory to ensure that when the swap file is activated it will not adversely affect the overall performance of the server.