vSphere Swap space vs OS Native Swap space

Swap Space in VSphere : vSphere Swap Space is different from OS swap.

1. What is OS Swap file?

· OS Swap space in is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

· Windows OS — Windows operating systems refer to their swap space as paging files. Some Windows operating systems try to increase the size of paging files automatically, if there is sufficient free disk space

· Linux OS — Linux operating systems refer to their swap space as swap files.

· mkswap — Sets up a Linux swap area.

· swapon — Enables devices and files for paging and swapping.

Important Note : To prevent virtual machine failure, increase the size of the swap space in your virtual machines.

2. What is vSphere Swap?

vSphere swap space is to act as the secondary source of memory when VMs are running short of memory. The .vswp file is created on power-on of the VM. It’s size is equal to the amount of Unreserved vRAM. This means if you have a VM with 8GB of vRAM, but 3GB is reserved, the .vswp will be 5GB.

· VMware no longer use a per host vmkernel swap file but a per VM swap file which is for the features for Memory over-commitment.

· Each Virtual Machine now gets its own “personal” swap file based on the max amount of memory assigned to it.

· The file has vswp extension and will be in the directory where all the VMs files are located.

· Swap is done when active memory of VM’s exceed the physical RAM available.

· The .vswp is used as a last resort if there is contention for physical RAM or we set memory limits on VMs.

· It is invoked after transparent page sharing or ballooning.

· If you do not over allocate physical RAM to vRAM, then it will never be used.

· It is deleted on power off and created on power on.

Important Note : If in your production environment if you are finding extensive swap usage than that means you should add some memory to this VM. You can’t ignore this because it will lead to VMs performance degradation.

3. Swap Space and Memory Over-commitment.

· You must reserve swap space for any unreserved virtual machine memory (the difference between the reservation and the configured memory size) on per-virtual machine swap files.

· This swap reservation is required to ensure that the ESX/ESXi host is able to preserve virtual machine memory under any circumstances. In practice, only a small fraction of the host-level swap space might be used.

· If you are overcommitting memory with ESX/ESXi, to support the intra-guest swapping induced by ballooning, ensure that your guest operating systems also have sufficient swap space. This guest-level swap space must be greater than or equal to the difference between the virtual machine’s configured memory size and its Reservation.

15+ years of IT experience, MCP, MCTS, MCSA (Win 2012), MCT, PMP, ITIL, Cisco Unity Support, VCP 3/4/5, VCAP-DCD, VCAP-DCA Certified

Posted in Virtualization, vSphere 5.0, vSphere 5.1
One comment on “vSphere Swap space vs OS Native Swap space

Leave a comment

Chetan Pisal, VCP 3/4/5. VTSP, VCAP-DCD, MCT, PMP

Chetan Currently Reading
Chetan Will Read
Blog Stats
  • 54,889 hits