Memory ballooning plays a key role in modern virtualized data storage architectures. With both physical and virtual assets demanding memory resources, there is a need to claim, release and reclaim memory in a variety of ways.
Memory ballooning is a common technique used by virtualization technology, one that makes use of virtual machine memory. In this Enterprise Storage Forum article we define memory ballooning and explain the concept of ballooning, including the technique’s relationship to virtualization hypervisors.
What is Memory Ballooning
A basic concept of cloud computing and virtualization that IT professionals have become accustomed to in recent years is the idea of elasticity or auto-scaling. That is, services and resources that scale up or down as needed to complete a given task or to meet a certain availability requirement.
Memory ballooning isn’t quite the same as auto-scaling, but it can be considered to be conceptually similar. Memory ballooning is all about enabling virtual machine memory to scale up if there is a requirement to do so. With memory ballooning, a system can provide more memory to a specific virtual machine as a burst-able capacity when needed.
The concept and approach of memory ballooning is specific to virtual machine memory and how VMware memory usage and VMware memory performance operates. Other hypervisors, including Microsoft’s Hyper-V, as well as the open source KVM project, have similar processes in place to provide a virtual ballooning capability for hypervisor memory.
What is a Hypervisor?
Memory ballooning works within a virtualization hypervisor. A brief hypervisor definition: a hypervisor is the technology that enables virtual machines to run, providing a virtual abstraction layer for software.
There are multiple hypervisor technologies that are widely used today, including VMware ESXi, Microsoft Hyper-V as well as the open source Xen and KVM technologies. Each hypervisor can be used to enable guest virtual machines, which run operating systems and applications in an abstracted, virtual approach.
The hypervisor makes use of drivers across running guest virtual machines to handle different requirements, including resource constraints such as virtual CPUs , disk space and memory. The balloon drivers runs across virtual machines and enable a hypervisor to reallocate memory from one virtual machine to another.
Understanding the Process of Memory Ballooning
Understanding how a hypervisor works is inherently related to understanding the process of memory ballooning. A hypervisor abstracts finite system resources and then allocates them to running virtual machine processes.
Host Physical Memory. The underling server or cloud platform has a certain amount of installed system memory that represents the absolute total amount of available memory.
Guest Physical Memory. The hypervisor is allocated a certain amount of the host’s physical memory in order to provide resources to running virtual machines. The guest physical memory is maximum amount of available memory to the hypervisor.
Guest Virtual Memory. The hypervisor allocates a given amount of its total memory resources as virtual memory to the running guest virtual machines.
In the memory ballooning model, one virtual machine that, for example, had 8 GB of guest virtual memory allocated to it that it was not using, could have a portion of that RAM reallocated to another running virtual machine that required the additional memory.
The balloon driver tracks the memory allocations from one virtual machine to another. The main objective of memory ballooning is to enable a virtual machine to get the memory it needs to meet a certain process or application demand spike. This happens even if it doesn’t normally have enough memory allocated to it.
Why is Memory Ballooning important?
- Resource optimization. With memory ballooning, memory is taken from virtual machines that aren’t currently using all available memory, with the unused memory reallocated to a virtual machine that requires the additional resources.
- Memory availability. Rather than simply not providing a virtual machine with the resources it requires due to a spike in demand or process, memory ballooning provides more memory when needed.
- Lower cost. By using memory more efficiently, there is less need to deploy more physical servers or allocate more physical memory, that incurs additional operational and energy costs.
Issues with Memory Ballooning
- High Balloon Memory Utilization. Among the ballooning problems that can occur is high utilization. It’s possible that the balloon driver can take so much memory that the hypervisor lacks the full resources it needs to operate at peak performance.
- Performance. If multiple running virtual machines request balloon memory at the same time, there can be a CPU and physical disk usage spike as the hypervisor pulls resources via memory swapping techniques, which further degrades overall system performance.