How to force VMware ESXi to reclaim memory (manually with script)
Emily Wong
Scenario
We have a VMware ESXi Server with 512GB RAM and we have 25 VMs with 64GB RAM with "0GB" reservation memory for VMs. They don't use all of their resources but we need to do this because they use all of their memory(64GB) once a day. When they do this ESXi gives VM 64GB and tries to reserve it for VM. I know ESXi is managing memory by ballooning and other ways but it shows used memory in the "Host Mem" section of VM 64GB.
- Total Server Mem: 512GB
- Total Guest Mem: 5%
- Total Host Mem: 470GB
Problem
We want to say ESXi if a VM didn't use memory for 10Min reclaim all reserved memory(Host Mem parameter). with powercli, VMtools, Linux script, a config and etc.
- VM Memory Size: 64GB
- VM Guest MEm: 1%
- VM Host Mem: 52GB (we want to reclaim this memory)
I know
I know about ballooning but we need to reclaim memory manually if possible. Or force ESXi to reclaim unused memory very fast.
21 Answer
As I get finally it is not possible to reclaim memory manually but we can tune memory usage with vSphere advanced settings.
Check if Ballooning, Compression, and Swapping happen for VMs if Ballooning and Compression happen it's not good and you should increase your resources or decrease the Number/resources of your VMs.
See more information in the VMWare community: