“Sharing is caring!”
I decided to quickly write down a few last words about a widely discussed topic before my 4 week journey to Brazil begins.
Transparent page sharing (TPS)
The concept of transparent page sharing has been widely explained and the impact discussed in all of the years (whitepaper). Short version: Multiple identical virtual memory pages are pointing to the same one page within the host memory.
The general behaviour has changed multiple times with enhancements within AMD’s & Intel’ newer CPU generations where large pages were intensively used (2MB instead of 4KB areas –> Increasing the chance of a TLB-Hit) and the benefits of TPS couldn’t be used until the ESXi host gets under memory pressure and changes it’s memory state to break up with his girlfri….I mean the large pages into small ones.
Last year some security concerns came up with this feature and VMware pro-actively deactivated the TPS feature with all newer ESXi versions and updates (KB).
I don’t want to talk about the impacts and design decisions on productive systems, but on homelab environments instead. It is nearly a physical constant that a homelab always lacks of memory.
By deactivating large pages & the new security mechanisms you can save a nice and predictable amount of consumed/host-backed memory.
And especially in homelab environments the risk of a lower performance (caused by the higher memory access time through the higher probability of TLB-misses) and of security concerns might be mitigated.
What to do?
Change on each ESXi host the advanced system settings
Mem.ShareForceSalting = 0
and wait a couple of minutes until TSP kicks in.
Effect on my homelab
60 minutes after the setting was done the amount of consumed RAM on my cluster (96GB RAM – setup) decreased from 55GB to 44,8GB which means around 20% memory consumption has been saved in my VM constellation (multiple identical Windows 2012 R2 and nested ESXi which have a high ‘shared’ value)
So if you need a very quick approach to workaround the memory pressure in your homelab and you can live the potential performance loss –> re-activate Transparent page sharing as a first step to optimize your environment. Sure you can also skip the deactivation of large pages and hope that during a change in the memory state the large page breakup process is quick enough and therefore TPS works again. But I preferred a permanent and audit-able approach of monitoring the amount of shared memory in my lab.
2nd step to optimize the memory consumption –> Size your VMs right… but this is nothing I will tell you about since my plane is going to start… my substitute vRealize Operations will do the job 😉