How VMware vSphere is saving physical memory ?

There are lot of  discussions is  going on the blogs,social media’s about the vSphere’s VM memory management. So i had just came up with VM’s memory analysis on the last article. But i haven’t explained the  memory saving techniques  on that article. Here we are going to discuss about that. If you look at the vSphere client’s resource allocation tab, You can see field called “shared” “swapped” “Compressed” “Ballooned” under Guest memory. These are the memory saving techniques which will rescue  the system when you have memory over-commit on the ESXi.

VM's Memory usage
VM’s Memory usage

> What is Over-committed memory ?

For an example, ESXi physical server is having 64GB RAM and configuring 9 VM’s with 8GB memory is over-committed .

Memory Overcommit on ESXi
Memory Overcommit on ESXi
  • ESXi’s Physical Memory: 64GB
  • VM’s Allocated Memory: 9x8GB = 72GB.

When the all VM’s are start utilizing it’s full memory quota, VM’s  may crash since you have only 64GB RAM but trying to access 72GB on that ESXi host. To avoid these kind of situation, VM kernel will initiate various memory saving technique to avoid the VM crash.

> What is shared ? (See the first image) What is TPS (Transparent Page Sharing) ? How it works ?

Shared is amount of memory that has been shared across other VM’s using TPS (Transparent Page Sharing) mechanism. Hope you have heard about the deduplication  on the storage. In storage, deduplication  is the process to  eliminate the duplicate copies of data using some check-sum mechanism. Same sense has been  applied for Memory here.Its just eliminates the duplicate memory contents at ESXi level.

TPS - VMware
TPS – VMware

In one ESXi host , you may run many similar VM’s (Ex: 10 Redhat Linux 6.5 VM’s). So the VM’s  memory pages will be same(Some part) as other VM since you have the same operating system installed on those. VMkernel will scan the host’s physical memory periodically and find the duplicate pages.It just removes the duplicate pages when the host system to run on low memory. The default page size will be 4k .Some of the new VM guests  will use 2MB page size  ,but you will get less duplicate pages since  2MB page is huge to match with other. But TPS will think more than us and it will break the 2MB page as 4k chunks and eliminates the duplicate.

> What is swapped ? How it works ?

This is traditional swapping mechanism which works in ESXi level. When the ESXi is running out of physical memory, It will start move the VM’s low priority pages to the disks.(Inactive memory). When the VM requires these pages , ESXi will bring it back to memory for use.This swapping will impact the VM’s performance. So its better to use the Guest level swapping.

> What is Compressed? How it works ?

ESXi provides the memory compression cache to boost the VM performance during the memory over-commitment. When the memory is over-committed, VMkernel will compress the VM’s low priority pages and stored in memory.

Memory Compression - Vmware
Memory Compression – Vmware

Compression provides better performance than swapping since the contents are retrieved from the memory where as swapping needs to be read from the disk.

> What is Ballooned ? How it works ?

Memory ballooning is one of the great memory reclaim method to overcome the memory over-commitment. All the VM’s may not use its full memory quota  but application/DB require that amount of memory for that VM during the peak time. VMware ESXi can reclaim the un-used memory during the memory over-commitment with help of ballooning the driver. Ballooning driver will communicate with VM’s using vmware tools when the memory pressure is increased and reclaims the memory pages which are used in VM.

Note: You should maintain the VMware tools up to date on the VM guests in an order to leverage these features.

Hope this article will help you to understand the VMware memory management.

Share it ! Comment it !! Be Sociable !!!