vSphere Hypervisor

 View Only
  • 1.  Ballooning question

    Posted Aug 09, 2011 03:36 PM

    I am trying to understand detail about how the balloon driver really works.

    My previous understanding has been that the whole purpose of the balloon driver is a means for the hypervisor ro reclaim memory from the guests when memory is overallocated and scare - this is because the guests have no other way to "give" memory back to the hypervisor, nor does the hypervisor know, and therefore has no way, to relaim memory as-needed from the guests.

    My other understanding, which I am now beginning to question, is that ballooning always causes the guest to page (using its internal paging techniques).  Also, everyone I talk to says the same, ballooning = paging in the guest.  Really?  What is making me question this is the difference between consumed and and active memory.  Consumed memory is still used by the VM - in other words, even though it is not active, is has not yet been reclaimed by the hyervisor, so the hypervisor cannot give it to other guests.  So my question is:  is the typical job of ballooning to reclaim consumed memory (which doesn't affect the VM), and then active memory (which will cause paging), or does it always just go after the active memory??

    My reasoning for thinking ballooning goes after consumed memory, and therefore does not always imply paging in the guest until it needs to reclaim active memory, is the following statement from VMware:

    Thoughts? I am overthinking this?

    Thanks

    Matt



  • 2.  RE: Ballooning question

    Posted Aug 09, 2011 04:19 PM

    Check out this link: http://www.yellow-bricks.com/2010/03/11/mem-idletax/

    Duncan wrote a book on some of this stuff.  Its a good read.



  • 3.  RE: Ballooning question
    Best Answer

    Posted Aug 09, 2011 04:38 PM

    mattheff wrote:

    My other understanding, which I am now beginning to question, is that ballooning always causes the guest to page (using its internal paging techniques).  Also, everyone I talk to says the same, ballooning = paging in the guest.

    Not quite.  The purpose of the balloon driver is to politely ask the guest to give back a pre-defined percentage (default 65%) of the unreserved memory (memory limit - memory reserved).  This is typically memory on a guest's free list.  If the memory is truly free, there is absolutely no impact to the guest - it may never have used the memory sitting on its free list anyway.

    If the memory is not free but is active, this will cause an impact on the guest.  For example, if you balloon within the pre-defined MS SQL buffer areas, SQL detects this and flushes its caches, including its query cache.  For Java applications, you could end taking away memory that it uses for its garbage collection and kill performance.

    Ballooning needs to be managed properly.  Done wrong, you'll kill yourself and take away memory that can cause guest applications to slow or crash (Linux OOM-kills are a known side-effect).  Done correctly and you'll free up idle resources and give them to those guests that actually need them allowing you to defer or eliminate possible memory purchases.



  • 4.  RE: Ballooning question

    Posted Aug 09, 2011 05:23 PM

    Ballooning will not *necessarily* cause paging, nor does it go after any particular 'kind' of memory, active or not.

    The balloon driver is really very simple - it just requests a big chunk of memory from the OS, and lets the OS determine how to service the request.  Now, MOST OS's will first give it free memory, then memory that was used for caching/buffers (Linux does this especially well), then it will start paging in order to service the request.

    more technical version:

    The balloon driver basically just does a big ole malloc() call to the kernel, and lets the kernel work it out however the kernel deems best.



  • 5.  RE: Ballooning question

    Posted Aug 09, 2011 11:53 PM

    Awesome guys.  All three of your answers were very helpful and informative.  Your answers also confirmed my line of thinking, and now I can tell everyone who says ballooning always = guest paging that they're wrong! Thanks.



  • 6.  RE: Ballooning question

    Posted Aug 11, 2011 06:10 AM

    There are two things associated with VM memory:Consumed memory and Active memory.

    Consumed Memory is the memory that VM sees with it and Active memory is the memory which VM is using actively.

    So suppose you have defined the memsize  for the VM as 4 GB but VM is actively using only 2GB.

    To achieve over-commitment, VMkernel backs up a guest VM with less memory than what the guest OS sees. It does so by balloon and swap. Balloon is a guest driver running in guest OS, allocating pages from within the OS and returning these pages back to VMkernel. If balloon is not sufficient, VMkernel then transparently unmaps machine memory pages from the guest OS, swaps the content to disk, and swaps them back if the guest OS accesses these pages.

    Both balloon and swap may impact the performance of applications inside the guest, since there is less machine memory to use.

    However, as long as an application’s active working set fits into  the guest VM’s memory share, it will not suffer significant performance  loss and swapping/paging of the pages will be done only when the active workings set is equal to consumed memory set.