VMware’s vSphere does some pretty amazing things with a host server’s memory in order to maximize the number of virtual machines that can be on a single server. After all, the more workloads that can reasonably run on a server, the fewer hosts that need to be provisioned.
When there is idle CPU time, vSphere looks for pages located across virtual machines that can be matched with one another and shared in physical RAM. This is basically a deduplication method applied to RAM rather than storage. For organizations that tend to use the same operating system for many virtual machines, the memory impact can be substantial. Take a look at the diagram below. In it, you will see two Transparent Page Sharing operations in action. You will see that there are two virtual machines that have big red boxes but there is only one big red box in physical RAM. This allows vSphere to use just a single copy of these shared bits even though the bits are shared across two virtual machines. This is a great improvement.
However, the bright green boxes show even more efficiency. In this example, there are four virtual machines sharing identical code that is stored only once in physical memory. As you extrapolate these examples to larger real life scenarios, it’s very easy to see how quickly Transparent Page Sharing can add up in the way of RAM savings.
Here are a few more things to know about TPS:
- A single VM can have multiple identical pages shared, thus further reducing that VM’s overhead.
- With newer systems having support for larger memory pages (2MB), it’s less likely that memory pages will be identical, so TPS is not used with Large Pages…
- …until the host system begins to run low on RAM. In these cases, large pages are broken down into smaller 4K chunks at which point TPS can work its magic.