Javatpoint Logo
Javatpoint Logo

What is Memory Ballooning?

Many memory management systems are used to utilize memory, but nowadays, a special type of memory management is used to manage memory, and this system is known as Memory ballooning.

Memory ballooning is a memory management feature used in most virtualization platforms to make more efficient use of physical memory for virtual servers. Memory ballooning is a critical component of modern virtualized data storage architectures. With physical and virtual assets requiring memory resources, various methods for claiming, releasing, and reclaiming memory are required.

Memory ballooning is a common virtualization technology technique that makes use of virtual machine memory. It is a memory management feature found in most virtualization platforms that allows a host system to artificially enlarge its memory pool by taking advantage or reclaiming unused memory previously allocated to various virtual machines.

This is achieved through a balloon driver installed on the guest operating system that the hypervisor communicates with when it needs to reclaim memory through ballooning.

What is a Hypervisor?

Memory ballooning occurs within a virtualization hypervisor. A hypervisor is a technology that enables virtual machines to run, providing a virtual abstraction layer for software. The hypervisor does the communication between these virtual machines.

Multiple hypervisor technologies are widely used, including VMware ESXi, Microsoft Hyper-V, and 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.

What is Memory Ballooning

The hypervisor uses drivers across running guest virtual machines to handle different requirements, including resource constraints such as virtual CPUs, disk space, and memory. The balloon drivers run across virtual machines and enable a hypervisor to reallocate memory from one virtual machine to another.

Process of Memory Ballooning

Understanding how a hypervisor works is inherently related to the process of memory ballooning. A hypervisor abstracts finite system resources and then allocates them to running virtual machine processes.

  • Host Physical Memory: The underlying server or cloud platform has a certain amount of installed system memory, representing the absolute total amount of available memory.
  • Guest Physical Memory: The hypervisor is allocated a certain amount of the host's physical memory to provide resources for running virtual machines. The guest physical memory is the 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.
What is Memory Ballooning

In the memory ballooning model, one virtual machine that 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 does not normally have enough memory allocated to it.

Why is Memory Ballooning Important?

In the operating system, memory ballooning is important because of the following reasons, such as:

  • Resource optimization: Memory is taken from virtual machines that are not currently using all available memory with memory ballooning. The unused memory is reallocated to a virtual machine that requires 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.

How does Memory Ballooning Work?

Memory ballooning is a computer memory reclamation technique used by a hypervisor to allow the physical host system to retrieve unused memory from certain guest virtual machines (VMs) and share it with others.

What is Memory Ballooning
  1. Memory ballooning allows the total amount of RAM required by guest VMs to exceed the amount of physical RAM available on the host.
  2. When the host system runs low on physical RAMresources, memory ballooning allocates it selectively to VMs.
  3. If a VM only uses a portion of the memory that it was allocated, the ballooning technique makes it available for the host to use. For example, if all the VMs on a host are allocated 8 GB of memory, some of the VMs will only use half the allotted share. Meanwhile, one VM might need 12 GB of memory for an intensive process. Memory ballooning allows the host to borrow unused memory and allocate it to the VMs with higher memory demand.
  4. The guest operating systemruns inside the VM, which is allocated a portion of memory. Therefore, the guest OS is unaware of the total memory available. Memory ballooning makes the guest operating system aware of the host's memory shortage.
  5. Virtualization providers such as VMwareenable memory ballooning. The host uses balloon drivers running on the VMs to determine how much memory it can take from an under-utilized VM. Balloon drivers must be installed on any VM that participates in the memory ballooning technique.
  6. Balloon drivers get the target balloon size from the hypervisorand then inflate by allocating the proper number of guest physical pages within the VM. This process is known as inflating the balloon, and releasing the available pages is known as deflating the balloon.

Issues with Memory Ballooning

Memory ballooning has some issues with it, such as:

  • 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 simultaneously, 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.

Ballooning Software in VMware

VMware requires that you first install the ballooning software in the VM to start using your VM in VMware.

  • The size of the balloon depends on how much memory is required by the VM. According to the requirement, the size of the balloon can be increased or decreased, thus making memory ballooning more dynamic.
  • To ensure that the performance is kept at top-notch, you should have a good amount of size in all the host machines, as the balloon drivers will remember the active memory usage of all the other host machines.
  • This system ensures that the memory in current usage or active memory should not exceed the host memory.
    (Active memory) < (Host memory)
  • In case of many virtual machines are activated simultaneously, then it will increase the workload suddenly on the hypervisor. Still, the advantage of using Memory ballooning is that it will not degrade the performance.
  • When many virtual machines join, and it creates a spike in the connections. So this problem also will not create degradation in the connection.

Advantages of Memory Ballooning

Memory ballooning has the following advantages, such as:

  • Even if the workload increases in the connection, the ballooning will not allow the system to degrade.
  • The biggest advantage of implementing this system is that it will utilize the most memory available in the connection.
  • It is dynamic so that this technique can be modified according to the industry or the company's requirements.

Disadvantages of Memory Ballooning

Memory ballooning seems to be a very good option for implementation, but it has some disadvantages, such as:

  • Overutilization of resources is when a balloon takes a lot of memory, and the hypervisor becomes scarce of giving memory to the incoming needy balloons.
  • As the hypervisor uses the memory swapping and sharing principle, if more than one virtual machine, inactive state, requests for memory, it can hamper the system performance. So, we should use the mutual exclusion principle.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA