This is really interesting and important question for the VMware professional. Who and when will host reclaim the memory, the answers follows:
VMKernel is responsible for the reclaiming the memory. VMKernel decides to reclaim the host memory based on their four states. ESX maintains the four memory states:
High @ 6% - No Action
Soft @ 4% - Ballooning
Hard @2% - Swapping + Ballooning
Low @1% - Swapping
ESX effectively supports 3 memory reclaim techniques such as:
1. Transparent Share Paging (TPS)
2. Ballooning
3. Host Swapping
Now, the ESX will decide which memory reclaims technique to be used at when. However, TPS is enabled by default and continuously running in the ESX host, it is not considered.
Let’s see the how memory state is calculated:
Memory State % = Physical Memory – Service Console Memory
When the memory state equals to high state (6%) or virtual machines use less than 94% of host memory, there won’t be any reclaim process invoked. When the memory state start to fall down, it will start to use the Ballooning mechanism to reclaim the memory. Ballooning will be started to use at soft state or 4% and if memory state is still further falls down to Hard state (2%), swapping will be used with addition of ballooning. Even the memory state drastically drops down to Low state (1%), swapping will be used as last resort and additionally blocks the execution of VMs that consume more memory than their target allocation.
Some situation, the ballooning will be kicked when memory state between hard and soft. Because, the balloon driver will take some time to identify the free pages and allocate them back to required state. This would help us to avoid the situation of soft or worse.
In certain scenarios, host memory reclaims can happen. Such as, if the VM has limit, the VMKernel tries to use host reclaim the memory using either ballooning or swapping even though the host memory has plenty of memory left to free.
How to check the memory state of the host:
Either remote SSH or Direct console to your ESX host and type “esxtop” then press “m” memory status:
Free state value can be configured by host attributes in ESX3.5. I am not seeing this attribute in ESX4.0 and later editions. I don’t know whether VMware hidden those attributes and replaced with different name. Anyway, the following screenshot taken from ESX3.5 host advanced configuration:
VMKernel is responsible for the reclaiming the memory. VMKernel decides to reclaim the host memory based on their four states. ESX maintains the four memory states:
High @ 6% - No Action
Soft @ 4% - Ballooning
Hard @2% - Swapping + Ballooning
Low @1% - Swapping
ESX effectively supports 3 memory reclaim techniques such as:
1. Transparent Share Paging (TPS)
2. Ballooning
3. Host Swapping
Now, the ESX will decide which memory reclaims technique to be used at when. However, TPS is enabled by default and continuously running in the ESX host, it is not considered.
Let’s see the how memory state is calculated:
Memory State % = Physical Memory – Service Console Memory
When the memory state equals to high state (6%) or virtual machines use less than 94% of host memory, there won’t be any reclaim process invoked. When the memory state start to fall down, it will start to use the Ballooning mechanism to reclaim the memory. Ballooning will be started to use at soft state or 4% and if memory state is still further falls down to Hard state (2%), swapping will be used with addition of ballooning. Even the memory state drastically drops down to Low state (1%), swapping will be used as last resort and additionally blocks the execution of VMs that consume more memory than their target allocation.
Some situation, the ballooning will be kicked when memory state between hard and soft. Because, the balloon driver will take some time to identify the free pages and allocate them back to required state. This would help us to avoid the situation of soft or worse.
In certain scenarios, host memory reclaims can happen. Such as, if the VM has limit, the VMKernel tries to use host reclaim the memory using either ballooning or swapping even though the host memory has plenty of memory left to free.
How to check the memory state of the host:
Either remote SSH or Direct console to your ESX host and type “esxtop” then press “m” memory status:
Free state value can be configured by host attributes in ESX3.5. I am not seeing this attribute in ESX4.0 and later editions. I don’t know whether VMware hidden those attributes and replaced with different name. Anyway, the following screenshot taken from ESX3.5 host advanced configuration:
Comments
Actuall I just answered my own question by reading this: http://www.gabesvirtualworld.com/memory-management-and-compression-in-vsphere-4-1/
For some reason, I still press 'publish comment'
:)