I already briefly touched on Sparse Swap in my VSAN 6.2 launch article. When talking about space efficiency and VSAN 6.2 most people will immidiately bring up RAID-5/6 and/or deduplication and compression. Those of course are definitely the big ticket items for VSAN 6.2, there is no doubt. Sparse Swap however is one of those tiny little enhancements to VSAN that can make a big difference in terms of cost and space efficiency. And although I already briefly discussed it, I would like to go over it again and show you an example why it makes a difference and when it can make a big difference.
First off all a bit of history. Up to VSAN 6.1 all “swap files” were created with a 100% space reservation. This means that when you deploy a VM and the VM has 4GB of memory, and no memory reservation defined, that a swap file will be created and 4GB of disk space will be reserved for this swap file. Now keep in mind that in order to ensure availability that swap file is not a single 4GB object, but actually 2 x 4GB. You can imagine that with a single VM the cost of that swap file is negligible. But with 100VMs per host and 1600 in a cluster that single 4GB swap file per VM now results in:
1600 VMs * 4GB * 2 (FTT overhead) =12800GB capacity reservation
Note that even with with RAID5 or RAID6 the FTT overhead would still be 2*, this is because swap is a special object and VM Storage Policies do not apply to it. Note that no other VM / object can reserve or use the space which is reserved for those swap files. When Sparse Swap however is enabled (advanced host setting) no capacity will be reserved for those VM swap files. This means that instead of losing 12800GB capacity you now don’t lose anything.
When should you use this? Well first and foremost when you don’t overcommit on memory! If you are planning to overcommit on memory then please do not use this functionality as you will need the swap file when there are no memory pages available. I hope that this is clear and you only use it when you are not overcommitting on memory. Linked clone desktops is one of those use cases where swap files are a significant portion of the total required datastore capacity, leveraging Sparse Swap will allow you to reduce the cost, especially when running all-flash. So now that we know why, how do you enable it? Well that is really simple:
esxcfg-advcfg -s 1 /VSAN/SwapThickProvisionDisabled
I hope this article makes it clear that this small enhancement can go a long way! Oh and before I forget, this neat small but useful enhancement was the result of a feature request a customer filed about 3 – 4 months ago, just think about that for a second, that is agility / flexibility right there, and yes our customers come first.