• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

vFrank

Essense of virtualization

  • LinkedIn
  • RSS
  • Twitter

Understanding VMware Ballooning

September 18, 2013 by FrankBrix 24 Comments

VMware ballooning is one of the hard concept to grasp. There are a lot of misunderstanding out there about this feature. I have been discussing this feature with customers and students during the last 5 years. This is my attempt to explain balloning.

VMware ballooning is a memory reclamation  technique used when and ESXi host is running low on memory. You should not see balloning if your hosts is performing like it should. To understand ballooning we would have to take a look at the following picture:

balloon1

 

 This picture shows the three levels of memory in a virtual environment. In a physical world we would only have the two top levels (virtual memory & guest physical memory) but in the virtual world we also have the host physical memory. What is important to know is that the hypervisor (ESXi) has no knowledge of what is happening inside the virtual machine (grey area). The hypervisor maps memory when the virtual machines asks for it. The hypervisor will then give it memory from “host physical memory” but only if memory is available. If memory is not available the memory can med mapped to the .vswp file on a vmfs or nfs datastore. The virtual machine has no knowledge if the memory is mapped to physical memory or to a disk. This is called hypervisor swapping, and this is the last resort for the vmkernel to use this mechanism.

Ballooning in short is a process where the hypervisor reclaims  memory back from the virtual machine. Ballooning is an activity that happens when the ESXi host is running out of physical memory. The demand of the virtual machine is too high for the host to handle.

Lets take a high level example:

  1. Inside a virtual machine you start an application. For instance solitaire
  2. solitaire as an application will ask the guest operating system (in this case windows) for memory. Windows will give it memory and map it from the virtual memory -> guest physical memory 
  3. what happens next is that the hypervisor sees the request for memory and the hypervisor maps guest physical memory -> host physical memory
  4. Now everything is perfect. You play solataire for a few hours. And then you close it down.
  5. When you close solitaire the guest operating system will mark the memory as “free” and make it available for other applications. BUT since the hypervisor does not have access to Windows’ “free memory” list the memory will still be mapped in “host physical memory” and putting memory load on the ESXi host.
  6. This is where ballooning comes into place. In case of an ESXi host running low on memory the hypervisor will ask the “balloon” driver installed inside the virtual machine (with VMware Tools) to “inflate”
  7. The balloon driver will inflate and because it is “inside” the operating system it will start by getting memory from the “free list”. The hypervisor will detect what memory the balloon driver has reclaimed and will free it up on the “host physical memory” layer!

The balloon driver can inflate up to a maximum of 65%. For instance a VM with 1000MB memory the balloon can inflate to 650MB. The way to avoid ballooning is not to uninstall the balloon driver but to create a “Memory Reservation” for the virtual machine. In case of full inflation for this particular VM the result is the hypervisor gets 650MB memory reclaimed. The downfall of this is that you risk your VM to do Guest OS Swapping to its page file! Just remember page file swapping is better than hypervisor swapping. Hypervisor swapping happens without the guest operating system is aware of it. Page file swapping it is the OS that decides what pages to swap to disk!

To check for ballooning you can either open ESXTOP or the vCenter Performance Graphs.

 

balloon2

 

balloon3

Filed Under: vSphere

Reader Interactions

Comments

  1. Quato says

    January 29, 2014 at 05:59

    Thanks!

  2. Sugumar says

    March 12, 2014 at 11:10

    Thank you so much for your post … Keep doing forw

  3. Marcos Isidro says

    May 5, 2014 at 19:53

    Many thanks for the great explanation!

  4. James Obe says

    May 15, 2014 at 20:36

    Detailed explanation; thanks !

  5. Rick says

    June 19, 2014 at 17:45

    Any idea how the host picks which VMs to inflate the balloon on? Does it pick the least constrained VMs first?

  6. 2x says

    July 12, 2014 at 23:20

    Some simple words, one example and vWold comes clearer. Thanks, vFrank!

  7. eMeN says

    May 5, 2015 at 16:49

    Great article. Helped me understanding and resolving “Driver Locked” RAMMap issue on VMs!

  8. siddharth says

    July 1, 2015 at 17:17

    Very well explained. Keep posting..Cheers!!

  9. David says

    August 31, 2015 at 12:36

    Great Article, Thank a lot.

  10. Rols says

    October 5, 2015 at 13:39

    The best explanation of ballooning I’ve read. Great work. Thanks!

  11. papali says

    February 7, 2016 at 17:51

    Great explanation! Gracias!!!

  12. Shashank says

    September 27, 2016 at 17:32

    if total 8 VM’s with 10 GB Virtual memory each are on a host with 100 GB RAM, assuming 20 GB of Memory is still free on host. Let us say 4 VM’s are using only 5 GB of RAM, and one VM wants more memory( around 14 GB of RAM). Will it take from host or from other VM’s?

  13. frankbrix says

    October 3, 2016 at 17:59

    Hi, don’t understand the calculation. How much memory is the virtual machines configured with?

  14. shashank says

    October 4, 2016 at 16:15

    each vm has 10 GB each.. do you have any formula for ballooning

  15. kei says

    July 6, 2017 at 01:44

    Just the thing i’ve been looking for since last year! thank you! do you have any article on swapping?

  16. bagit airlangga says

    August 9, 2017 at 11:47

    great explanations !

  17. Andrew Clemence says

    September 17, 2017 at 10:12

    There will be no ballooning if there is no over-provision of memory. Having only 80% of the host memory allocated is under-provisioned and there will never be any ballooning.

Trackbacks

  1. Tuning ESXi Host Memory Configuration says:
    February 3, 2014 at 14:28

    […] http://www.vmware.com/pdf/Perf_Best_Practices_vSphere5.0.pdf http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004082 http://blogs.vmware.com/vsphere/2012/02/disable-ballooning.html http://www.vmware.com/files/pdf/mem_mgmt_perf_vsphere5.pdf http://www.vfrank.org/2013/09/18/understanding-vmware-ballooning/ […]

  2. Maintenance considerations that may improve virtualization | Sampier's Blog says:
    April 23, 2014 at 12:48

    […] RAM memory – Although many modern virtualization hosts have an extremely intelligent memory management system. It might be naive to extensively over allocated memory if your applications are memory constrained. If you consider having a similar environment and/ or if the application itself is not fully utilizing memory, you can typically employ some over allocation and rely on technologies, such as memory sharing, or advanced techniques for dynamic allocation of memory such as VMware ballooning. […]

  3. 20140717 | gumdaeng says:
    July 17, 2014 at 13:22

    […] (http://www.vfrank.org/2013/09/18/understanding-vmware-ballooning/) […]

  4. VMware ballooning nedir? ~ vmware.pro - virtually, everything is possible. says:
    December 15, 2014 at 14:18

    […] http://www.vfrank.org/2013/09/18/understanding-vmware-ballooning/ […]

  5. How to check if balloon driver is inflated in a Linux VM | rtfmp says:
    March 18, 2016 at 12:35

    […] has one of the best and concise explanation on memory ballooning. A more in depth technical paper on the topic and in general memory […]

  6. How to check if balloon driver is inflated in a Linux VM | rtfmp says:
    March 18, 2016 at 13:24

    […] has one of the best and concise explanation on memory ballooning. A more in depth technical paper on the topic and in general memory management […]

  7. VMware Interview Question | mannc14 says:
    April 26, 2016 at 09:59

    […] The virtual machine will probably request more that 1 GB for its application and when this happens ballooningand hypervisor swapping will […]

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Blogroll

  • Hazenet
  • Michael Ryom
  • Perfect Cloud
  • vTerkel

Copyright © 2023 · News Pro on Genesis Framework · WordPress · Log in