So here we are with another post in this series. In previous post we discussed basics of memory virtualization concepts and the need for memory reclamation. In this post we will explore ESXi host memory states, sliding scale method of calculating Mem.MemMinFreePct.
As discussed in previous post, multiple VMs that run on ESXi host, share the memory resource of an ESXi host. As the demand grows across multiple VMs, in the situation such overcommitment, it is possible that ESXi server may end up in contention for memory resource. Eventually it should not be the situation that entire physical memory is consumed by VMs. There should be certain amount of free memory available and guaranteed to the hypervisor.
What is Mem.memminfreepct value?
Mem.memminFreePct value determines the amount of physical memory that VMKernel should keep free on ESXi host to ensure stability of the system. Free memory on ESXi host below this value, may result in memory contentions on the host.
ESXi host uses a sliding scale method to determine the Mem.MemMinFreePct value. By using a sliding scale, a sensible value is calculated regardless of the memory size of the ESXi host. This is done automatically as you can see in above screen shot, the default value is set to 0 which means automatic calculation.
You can use tools such as ESXTOP to check the Mem.MemMinFreePct value.
Mem.MemMinFreePct is not a fixed value, instead it is auto-calculated using the sliding scale as mentioned earlier and the Mem.MemMinFreePct value depends on the host memory configuration.
That being said, it is time to understand how the calculations are done.
Sliding Scale Method
Below table can help to calculate the Mem.MemMinFreePct value.
|6%||First 4 GB (0-4 GB)|
|4%||Next 8 GB (4-12 GB)|
|2%||Next 16 GB (12-28 GB)|
|1%||Remaining memory after 28 GB|
This is better understood with an example. Let us take an example of ESXi host with 100 GB Memory to understand sliding scale calculation of Mem.MemMinFreePct.
- For the first 4 GB of memory we will set aside 6% of it which is equal to 245 MB.
- For next 8 GB from 4-12 GB range, we will set aside 4% of it which is equal to 327 MB.
- For next 16 GB from range of 12-28 GB, we will set aside 2% of it which is equal to 327 MB.
- For remaining 72 GB (100 GB memory – 28 GB), we will set aside 1% of it which is 720 MB.
Now we just need to calculate sum of all these values.
Mem.MemMinFreePct = 245 + 327 + 327 + 720
Mem.MemMinFreePct = 1619 MB
Once the Mem.MemMinFreePct is calculated, ESXi host uses it to further calculate multiple memory thresholds to determine memory states.
Memory states and their thresholds:
There are five different memory states that are calculated based on Mem.MemMinFreePct. Below are the memory states in ESXi host.
Below table helps us to understand at which threshold these memory state are active in ESXi host.
|Memory state||Memory Threshhold|
|High||300% of Mem.MemMinFreePct|
|Clear||100% of Mem.MemMinFreePct|
|Soft||64% of Mem.MemMinFreePct|
|Hard||32% of Mem.MemMinFreePct|
|Low||16% of Mem.MemMinFreePct|
So based on our example above for an ESXi host with 100 GB memory,
- High State threshold will be 4875 MB
- Clear State threshold will be 1619 MB
- Soft State threshold will be 1036 MB
- Hard State threshold will be 518 MB
- Low State threshold will be 259 MB
Based on which memory state is active, respective memory reclamation techniques are initialized by the ESXi host.
Below table explains, which memory reclamation techniques are associated with these memory states.
|Memory State||Reclamation Techniques|
|High||TPS-small Memory pages (Large memory pages are Scanned only)|
|Clear||TPS (Large memory pages)|
|Soft||TPS + Balloonning|
|Hard||TPS + Compression + Swap|
|Low||TPS + Compression + Swap + Block|
- The soft and hard memory states are related to virtual machine performance and memory starvation prevention.
- The threshold for the low state protects the VMkernel layer from PSOD issues caused from memory starvation on ESXi host.
- The VMkernel employs more drastic memory reclamation techniques when it approaches the Low state. The hypervisor also blocks the execution of all VMs that consume more memory than their target memory allocations.
In this post we discussed, Mem.MemMinFreePct value, Memory states in ESXi host and sliding scale method to calculate Mem.MemMinFreePct along with thresholds for memory states. We also briefly talked about reclamation techniques associated with Memory states. This discussion is brief overview of how ESXi host reacts to the contention. From the next post, we will start exploring each of the memory reclamation technique starting with Transparent Page Sharing (TPS).