Page 1 of 1

Memory ballooning - unclear points

Posted: 13. Jul 2016, 07:30
by Winxp-on-Macos
Hi,
Memory ballooning seems to be the feature we need to apply.
However, questions regarding few fundamental points are still open on our side, these follow below.

This functionality sounds like one vm to donate its memory to other vms.
In our mind this term 'donating' describes the purpose closer, so let's use this terminology
in our description of open points below.

Code: Select all

VBoxManage vmcontrol guestmemoryballoon
....
seems to start such memory donation. The vm this command been carried out seems to be the donator.
However, how to assign the donated memory to vm asking for such?
We can't see in whole system (VB, guest OS) no place where the additional free memory resources were reported.

Re: Memory ballooning - unclear points

Posted: 13. Jul 2016, 08:45
by socratis
Winxp-on-Macos wrote:Memory ballooning seems to be the feature we need to apply.
Why? What are your needs that you want to apply the memory balloon feature?
Winxp-on-Macos wrote:We can't see in whole system (VB, guest OS) no place where the additional free memory resources were reported.
And you won't. As per the manual:
The memory made available through the ballooning mechanism is only available for re-use by VirtualBox. It is not returned as free memory to the host. Requesting balloon memory from a running guest will therefore not increase the amount of free, unallocated memory on the host.

Re: Memory ballooning - unclear points

Posted: 13. Jul 2016, 19:33
by Winxp-on-Macos
Quite obvious need, running vm's show high requirements reg. populated memory (in the sum higher than
to assign bad-case amount of memory to all vm's), however not permanently,
and seldom at the same time. I think this is the typical purpose. Why is this information critical for answering asked question?

As mentioned in initial post we are not looking for indication additional free memory available for
new assignments
on the host side. Once again, we search for this on VB and VM's level.

Unfortunately still no answer to the major question However, how to assign the donated memory to vm asking for such?
No clear hints in manual.
Will it be the

Code: Select all

VBoxManage vmmodify ...
commannd? In manual not described as such.
VB 5.0.22 is used. This seams to be host os and guest os agnostic point, means VB-specific, therefore this thread in General sub-forum.

Re: Memory ballooning - unclear points

Posted: 13. Jul 2016, 20:23
by scottgus1
Asking for the need can help us tune our suggestions.
Say for example you have a host with 4GB memory and you wish to run two 2GB guests concurrently, and you think memory ballooning would help. Once you state your intended use we would be able to say if memory ballooning is a fit for your intent. Thus the request for your usage.

I would consider it safe to assume you read the manual, section 4.9. Your understanding of memory ballooning, or "donation" as you put it, seems accurate:
When memory ballooning is requested, the VirtualBox Guest Additions (which run inside the guest) allocate physical memory from the guest operating system on the kernel level and lock this memory down in the guest. This ensures that the guest will not use that memory any longer: no guest applications can allocate it, and the guest kernel will not use it either. VirtualBox can then re-use this memory and give it to another virtual machine.

The memory made available through the ballooning mechanism is only available for re-use by VirtualBox. It is not returned as free memory to the host. Requesting balloon memory from a running guest will therefore not increase the amount of free, unallocated memory on the host.
The command to set a guest to temporarily allow taking memory from it seems to be:

Code: Select all

 Vboxmanage controlvm "vmname" guestmemoryballoon <balloonsize in MB>
and for a guest you always want to allow taking memory from, issued while the guest is shut down:

Code: Select all

VBoxManage modifyvm "VM name" --guestmemoryballoon <balloonsize in MB>

Ballooning requires Guest Additions and only works with 64-bit non-Mac hosts. Donating the balloonable memory seems to be done automatically if it is possible to do so; there seems to be no command to force the balloon to take place. You set your guests to allow certain amounts of their normal memory to donate, and if a demand on Virtualbox requires it the memory will be donated. You apparently can't make it happen manually.

All of this I deduce from reading the manual, I have never had need for ballooning, I'd rather fly a plane. :) Seriously, I have never used this feature, just reading about it.