VMware Inter-VM Transparent Page Sharing
Enable Inter-VM Transparent Page Sharing (v5.x – 6.7)
If you’re using VMWare ESXi in a non-production environment, such as a home lab, consider changing the advanced host setting Mem. ShareForceSalting
to “0” in order to encourage likeliness of the hypervisor to increase the inter-VM page sharing pool. After doing so, the PSHARE on my host increased from about 3GB to 4.5GB with 3767MB savings (esxtop then press m).
PMEM /MB: 32672 total: 1636 vmk,28639 other, 2397 free
VMKMEM/MB: 32510 managed: 939 minfree, 15602 rsvd, 16907 ursvd, clear state
PSHARE/MB: 4541 shared, 788 common: 3753 saving
SWAP /MB: 0 curr, 0 rclmtgt: 0.00 r/s, 0.00 w/s
ZIP /MB: 0 zipped, 0 saved
MEMCTL/MB: 0 curr, 0 target, 12773 max
The concept of salting has been introduced to help address concerns system administrators may have over the security implications of TPS as described in KB Security considerations and disallowing inter-Virtual Machine Transparent Page Sharing (2080735). Salting is used to allow more granular management of the virtual machines participating in TPS than was previously possible. As per the original TPS implementation, multiple virtual machines could share pages when the contents of the pages were same. With the new salting settings, the virtual machines can share pages only if the salt value and contents of the pages are identical. A new host config option Mem.ShareForceSalting
is introduced to enable or disable salting.
By default, salting is enabled after the ESXi update releases mentioned above are deployed, (Mem.ShareForceSalting=2) and each virtual machine has a different salt. This means page sharing does not occur across the virtual machines (inter-VM TPS) and only happens inside a virtual machine (intra VM).
When salting is enabled (Mem.ShareForceSalting=1 or 2) in order to share a page between two virtual machines both salt and the content of the page must be same. A salt value is a configurable vmx option for each virtual machine. You can manually specify the salt values in the virtual machine’s vmx file with the new vmx option sched.mem.pshare.salt. If this option is not present in the virtual machine’s vmx file, then the value of vc.uuid vmx option is taken as the default value. Since the vc.uuid is unique to each virtual machine, by default TPS happens only among the pages belonging to a particular virtual machine (Intra-VM).
If a group of virtual machines are considered trustworthy, it is possible to share pages among them by setting a common salt value for all those virtual machines (inter-VM).
The following table shows how different settings for TPS are used together to effect how TPS operates for individual virtual machines:
Mem. ShareForceSalting (host setting) | sched.mem.pshare.salt (per VM setting) | vc.uuid (per VM setting) | Salt value of VM | TPS between VMs (Inter-VM) | TPS within a VM (Intra-VM) |
0 | Ignored | Ignored | 0 | Yes, among all VMs on host. | yes |
1 | Present | Ignored | sched.mem.pshare.salt | Only among VMs with same salt | yes |
1 | Not Present | Ignored | 0 | Yes, among all VMs | yes |
2 | Present | Ignored | sched.mem.pshare.salt | Only among VMs with same salt | yes |
2 (default) |
Not Present (default) |
Present (default) | vc.uuid | No inter-VM TPS | yes |
2 | Not Present | Not Present | random number | No inter-VM TPS | yes |
For more information on TPS, see:
- For ESXi 5.0 the Sharing Memory Across Virtual Machines section of the vSphere Resource Management guide
- For ESXi 6.5 the Sharing Memory Across Virtual Machines section of the vSphere Resource Management guide
- For ESXi 5.5 – 6.7 the Sharing Memory Across Virtual Machines section of the VMWare vSphere Documentation
- http://blogs.vmware.com/vsphere/2015/01/assess-the-performance-impact-of-the-security-change-in-transparent-page-sharing-behaviour.html
- https://kb.vmware.com/s/article/2097593