Using large pages in VMs

VMware ESXi provides 2 MB memory pages, commonly referred to as large pages, along with usual 4 KB memory pages. ESXi will always try to allocate 2 M pages for main memory and only on failure try for a 4 or small page. VMs are large pages if 2 M sequences of contiguous are available. The idea is to reduce the amount of page sharing and also increase the memory footprint of the VMs. The biggest benefit is of mitigating TLB-miss (short for Translation Lookaside Buffer), which costs as much as possible for Nested Page Table-enabled servers running ESXi.

However, allocating memory in 2 M chunks may cause the memory allocated to the VM to become fragmented. But as small pages are allocated by a guest and VM, these larger sequences need to be broken up.

So if defragmentation occurs, there could be enough memory to satisfy a large page request even when there is no 2 M contiguous Memory Page Number available. The defragmenter's job is to remap the existing allocated small pages in a 2 M region to allow that range to be mapped with a large page.

Transparent Page Sharing (TPS) runs across a host's VMs periodically (every 60 minutes by default) and reclaims identical 4 KB pages. However, this only happens when there are no large pages (2 MB pages). If you use large pages (2 MB), TPS does not come into the picture because of the cost of comparing these much larger pages. This is until there is memory contention, at which point the large pages are broken down into 4 KB blocks and identical pages are shared.

Large pages offer performance improvements. Reclamation of large pages does not happen if there is not enough physical memory to back all of the VMs' memory requests.

Memory saving happens due to TPS kick in when you run lots of VMs with very similar memory usage on a host. You will not see any memory saving until your host thinks it is under pressure, which will happen if large pages don't get shared. The host will wait until it hits 94 percent memory usage (6 percent free) before it deems itself under memory contention and starts to break those large pages into smaller 4 KB ones.

In a typical environment where you have many similar VMs, you are consistently going to run your host at around 94 percent memory used. All those identical memory pages can still be reclaimed, just as before, and you are gaining performance gain of large pages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.111.85