VMware Ballooning explained
In my last post I explained a memory reclamation technique called Transparent Page Sharing. This post is dedicated to the Balloon driver method.
The first thing to be clear about is that Memory Ballooning is a technique that is only engaged when the host is running low on physical memory. If you have a host with 60 GB of physical memory available and the virtual machines are only allocated a total of 30GB of memory, then you may never need to know what memory ballooning is all about. However if you are over committing your hosts then this is an important topic to review.
Memory that is allocated to a virtual machine might not all be actively used. Think about it, if 4 GB is assigned to a machine, the applications may only be using 2GB of it actively. As far as an ESXi host is concerned though, 4GB of memory is basically off limits because it’s assigned it to a VM. VMware ballooning basically consists of the host asking for some of that memory back.
Remember that one of the things we like most about virtualization is that the host doesn’t know what the guest OS is doing. At the same time, the guest OS doesn’t realize that it’s running inside of a virtual machine either. In order for the host to request memory back from the guest OS it needs to use the balloon driver (vmmemctl.sys) to communicate this information.
When the ESXi host runs low on memory it uses the balloon driver to determine what memory the virtual machines can give up to prevent the host from paging to disk.
For more information about memory ballooning please check out the Memory Resource Management document put out by VMware. http://www.vmware.com/files/pdf/perf-vsphere-memory_management.pdf