VSAN 6.2 Part 5 – New Sparse VM Swap Object

vsan_stretch_graphic_v02_300dpi_01_square140Those of you who have a good understanding of VSAN at this stage will know that a virtual machine deployed on the VSAN datastore is deployed as a set of objects, and not a set of files, which is how a VM is deployed on traditional datastores. Those objects include the VM Home Namespace, VMDKs and of course VM Swap. VM Swap is interesting, in that it only exists when the VM is powered on, but on VSAN it has always been provisioned with 100% Object Space Reservation in the past. This has some drawbacks, since it tended to consume a lot of capacity. For example, if I deployed 100 VMs, each with 8GB of memory, then there is 800GB of disk provisioned for the VM swap. This is reserved space that I may never even use if the VM never experiences resource issues.

The good news is that in VSAN 6.2, we have a way of deploying VM swap as thin.

The first thing to note is that this advanced setting needs to be set on each ESXi host that is in the VSAN  cluster. The setting is called SwapThickPrivisionDisabled, and is disabled by default:

[root@esxi-a-pref:~] esxcfg-advcfg -g /VSAN/SwapThickProvisionDisabled
Value of SwapThickProvisionDisabled is 0
To enable it:
[root@esxi-a-pref:~] esxcfg-advcfg -s 1 /VSAN/SwapThickProvisionDisabled
Value of SwapThickProvisionDisabled is 1

Now when virtual machines are powered-on on the VSAN datastore, their VM Swap objects are provisioned thin, i.e the Object Space Reservation policy setting of 100% in no longer implemented.

I took some screenshots of the new VSAN 6.2 capacity views with virtual machines that had default VM Swap, and then I powered them off, set the advanced setting on all the hosts and then powered them on again.

The first screenshot here is the capacity view grouped by object type. The 10 or so VMs that I have powered on are consuming 84.09GB of swap space. This is using the default Object Space Reservation = 100%.

swap beforeI now powered off the VMs, and made the /VSAN/SwapThickPrivisionDisabled advanced setting changed on the ESXi hosts. As expected, there are no VM swap objects consuming space on the VSAN datastore.

swap - vm offThe final step is to power the VMs back on now that the advanced parameter is set. As you can now see in the capacity view, swap objects are now only consuming 88MB of capacity, a significant difference to the default shown previously.

swap thinThis new feature can provide a considerable space-saving on capacity space consumed. This will rely on how many VMs you have deployed, and how large the VM swap space is (essentially the size of unreserved memory assigned to the VM).

2 Replies to “VSAN 6.2 Part 5 – New Sparse VM Swap Object”

Comments are closed.