vSAN Sparse Swap

Although this is not a new feature, it still seems to be a little known feature by many that can save you quite a bit of disk space. Prior to vSAN 6.2, all VMs were created reserving 100% of the configured memory, when there were no memory reservations defined. Because vSAN makes copies of the objects, we would need 2x the size of the memory per VM to be reserved for swap space. Remember that default policy is FTT=1 (2 copies), and swap being a “special” object, it will get the default policy (not subject to SPBM) and not Raid5 or Raid6 otherwise. On average, VMs have ~4GB-8GB of memory, depending on the workload of course. When we multiply this by the number of VMs, we can end up using quite a bit of reserved storage for swap objects. If we assume ~1,000 VMs per cluster, we would use ~8TB of space, in theory.

 

When is swap needed?

When  you overcommit memory, swap will be needed; and when you don’t overcommit, you may benefit by disabling SwapThickProvision in order to save some space.

This is an advanced config setting per host in the cluster. You can set this up through UI(6.5+), CLI, PowerCLI, and even Host Profiles.

 

CLI

get:  esxcfg-advcfg -g /VSAN/SwapThickProvisionDisabled

if 0 = Enabled. Swap is thick provisioned

if 1 = Disabled. Space savings

set:   esxcfg-advcfg -s 1 /VSAN/SwapThickProvisionDisabled

 

UPDATE ***another command using esxcli***

list: esxcli system settings advanced list -o /VSAN/SwapThickProvisionDisabled

set: esxcli system settings advanced set -o /VSAN/SwapThickProvisionDisabled -i 1

PowerCLI

A colleague of mine, Jase McCarty, created a PowerCLI script to set this at the Cluster level… Talk about the “easy button”/

https://github.com/jasemccarty/Vsan-Settings/blob/master/Vsan-SetSwapFiles.ps1

 

Host Profiles

The host profiles works the same way whether VSAN is enabled or not, you still create the profile from a host, apply it, check compliance, remediate. You will of course see more settings if vSAN is enabled.

I mentioned that this is an advanced configuration setting, so this setting is not visible on the host profile, unless this was set to 1 prior to exporting the host profile from one of your hosts. That means, you will have to manually set this on one host, and then export the profile for it to be visible on the WebClient.

 

UI

vSAN 6.5 –  Host>Configure>Advanced System Settings>Edit>VSAN.SwapThickProvisionDisabled> Set to 1

 

Friendly Advice: Again, if you are overcommitting memory on your hosts, DO NOT disable SwapThickProvision.

2 thoughts on “vSAN Sparse Swap

Comments are closed.