VMware Transparent Page Sharing – Is it on? How much RAM is it saving?


VMWare TPS (Transparent Page Sharing) is a mechanism within the hypervisor to allow the saving of RAM by allowing virtual machines where their memory matches to only store a copy of the memory used once. I.e. If you had 5 Windows 2012 R2 virtual machines running, they are going to be almost completely identical, so if each VM was assigned 4GB of RAM, rather than it using 20GB of RAM, it would transparent page share so you’d be using 4GB of RAM plus some small amount of additional memory (assuming that the VMs are similar enough). Obviously in a large environment this saving in RAM could be quite large, meaning a saving in physical RAM needed to be purchased.

Its worth noting however, TPS has been turned off in 5.5 update 2 onwards. This is explained in thislink. But you can re-enable this if you so wish. Instead, VMs will only share memory pages if they have a matching salt.

But how do you tell if TPS is on, and how much RAM is it saving you?

To tell if a host has TPS salting enabled (so in the real sense TPS is disabled, unless you’ve configured the same salt for each VM), first click on the host, then click “configuration” then click “advanced settings”, then click on the “mem” node. On the right hand pane look for the setting: mem.shareForceSalting (seeVMware KB for more details) if it is set to 0, or it doesn’t exist TPS will be enabled. If it it is set to 1 or 2, you’ll find that TPS is not enabled unless you have configured a per VM option.

  • To allow inter-VM TPS for all virtual machines after installing 5.5 update 2 or above, you need to set mem.shareForceSalting to 0 for all the ESXi hosts.

Based on what the VMWare KB article says (link above) within the table of settings:

  • To allow inter-VM TPS for select virtual machines (that are safe to share memory) set mem.shareForceSalting to 1 for all the ESXi hosts then on each VM set the sched.mem.pshare.salt setting on each VM to a common value.

If you don’t do this after applying the update, the default settings are to set the mem.shareForceSalting to 2, which uses the vc.uuidz salt value, which will likely be blank for each VM, so it will generate a random salt for each VM, thus turning off TPS.

To see how much RAM you are saving from an SSH console run this command:

# esxtop

Now press “m” to view the memory.

Notice at the top the line called PSHARE/MB, this line shows TPS in action, so if it said:

PSHARE/MB: 32030 shared, 3899 common: 28131 saving

This would mean that the VMs are using 32030MB of RAM which is basically the same between all the VMs, so to store 32030MB of RAM, ESXi only actually needs to store 3899MB (i.e. the common memory), meaning that 28131MB of RAM is being saved by TPS.

Image Attribution