Why Memory reclamation:
ESXi supports memory over commitment in order to provide higher memory utilization and higher ratio of consolidation. In order to effectively support memory over commitment, the hypervisor provides efficient host memory reclamation techniques.
ESXi uses several techniques to reclaim virtual machine memory, which are:
- Sliding scale Method
- Transparent page sharing (TPS)
- Memory compression
- Hypervisor swapping
Now the question is, when do these techniques are running, is it always? is it at specific threshold? So let’s explore that too.
Which memory reclamation technique is active will depend upon which memory state is active currently.
Following are the possible memory states in ESXi host.
- Clear (New in vSphere 6 onward)
I have explained these states in another article on Sliding scale method
Below chart explains which memory reclamation technique will be active considering which memory state is active.
- NOTE: As we all know that vSphere 6 onward, TPS is by default turned OFF. However, if you enable it, the TPS runs always and tries to share memory pages like what we had in old versions of ESXi but this is applicable only on small memory pages i.e. 4KB pages.
- When available free memory is less than High state but more then Clear state as in chart above then ESXi will start preemptively breaking up large pages so that TPS (If enabled in vSphere 6) can collapse them at next run cycle.
- If the amount of available free memory is bit less than the Min.FreePct threshold as in chart above, the VMkernel applies ballooning to reclaim memory.
- The ballooning memory reclamation technique introduces the least amount of performance impact on the virtual machine by working together with the Guest operating system inside the virtual machine, however there is some latency involved with ballooning.
- Compression helps to avoid hitting the low state without impacting virtual machine performance, but if memory demand is higher than the VMkernels’s ability to reclaim, drastic measure of Hypervisor swapping is taken to avoid memory exhaustion.
- However, hypervisor swapping will introduce VM performance degradation’s due to issues like high latancy rate, paging/double paging. For this reason this reclamation technique is used when situation require drastic measurements.
Below is the list of articles in this series for further reading.
PART2: Mem.minfreepct and sliding scale method
PART3: Transperent Page sharing
PART4: VMware Ballooning
PART5: VMware Memory Compression
PART6: Hypervisor Swapping and Host SSD Swap