Page 1 of 1

Virtualbox memory balloon

Posted: 3. Dec 2016, 01:05
by thoja21
I am trying to get memory ballooning working on an Ubuntu 16.10 (64 bit) host running 2 test VMs.
I can't seem to make sense of the documentation in the Virtualbox manual (chapters 4 + 9) and there doesn't seem to be any answers or working examples to this question on the internet.

NOTE - this is just a test. I do not intend to keep these VMs. I want to experiment with memory ballooning in Virtualbox.

My setup:

Host: Ubuntu desktop 16.10 64bit 64GB RAM

VMs:

- VM1: Ubuntu server 16.04LTS 64bit - VBox guest additions - 16GB RAM
- VM2: Ubuntu desktop 16.04LTS 64bit - VBox guest additions - 500MB RAM


Goal:

VM1 to share unused RAM with VM2.

--------------------


I have currently tried:

Code: Select all

vboxmanage modifyvm vm1 guestmemoryballoon 10000
I can see the VM using around 10GB of RAM when running after running the command above.

From here I don't know what to do next to get VM2 to use any of the spare memory from VM1. The manual does not say. I have tried running:

Code: Select all

VBoxManage controlvm vm2 guestmemoryballoon 400
On VM2 but this creates a balloon on VM2 and uses 400MB of RAM which I don't want.

I have also tried to use VBoxBalloonCtrl but this does not seem to do anything except print to the terminal notices about timeouts for all of my Virtualbox machines:

Code: Select all

vboxballoonctrl --balloon-max 400 -v
I am using the latest version of Virtualbox (as of this post -- 5.1.10).

If anyone has any working examples of how to give VM2 some extra memory from the VM1's balloon then that would be great. I'm at a loss on how this works!

Thanks!

Re: Virtualbox memory balloon

Posted: 3. Dec 2016, 14:21
by mpack
I think we'd need to see a VM log from both VMs.

Re: Virtualbox memory balloon

Posted: 3. Dec 2016, 14:33
by thoja21
Hi mpack, thanks for your reply.

I've attached the logs for both VMs.

I'm not worried about fixing these VMs if I've missed any config. I.e. I'm happy to start over if anyone can provide some clear instructions/steps on how to set ballooning up to do what I want: share spare memory from one VM with another.

Re: Virtualbox memory balloon

Posted: 4. Dec 2016, 11:59
by mpack
Well, I'll say right off that I personally do not use the ballooning feature, so I can't speak as an expert, only as an observer. But, until an actual expert comes along I may be the best you can get.

Some things I note from the logs.
VBox logs wrote: 00:00:01.165239 MemBalloonSize <integer> = 0x0000000000001388 (5 000, 4 KB) -- LinuxVM1
...
00:00:01.121187 MemBalloonSize <integer> = 0x0000000000000000 (0) -- LinuxVM2
This section enables and disables features. Does this mean that ballooning is disabled in VM2?
p.s. I assume the "KB" legend is a logging typo. Everything else related to ballooning seems to use units of MB, so I read VM1's balloon size as 5000MB (4.88GB).
VM1.log wrote: 00:00:01.165064 VBoxInternal2/Watchdog/BalloonCtrl/BalloonSizeMax="10000"
...
00:00:01.165245 RamSize <integer> = 0x000000026fe00000 (10 466 885 632, 9 982 MB, 9 GB)
Seems to be saying that max balloon size is greater than the total RAM allocated to the VM.

Otherwise it all seems ok.

Re: Virtualbox memory balloon

Posted: 4. Dec 2016, 12:06
by mpack
On a point of curiosity, how are you determining whether ballooning is working or not? Apart from the fact that the VMs will start up on an overcommitted host (which you are far from doing), I can't offhand think of an easy way.

Re: Virtualbox memory balloon

Posted: 5. Dec 2016, 00:41
by thoja21
how are you determining whether ballooning is working or not?
Only by seeing the Virtualbox process consuming the RAM I set in the ballooning command on the VM guest (vboxmanage controlvm ....). Although I'm unsure whether that is actually good enough or instead meaning that the guest is simply 'ready to share memory'. Other than that it just seems to sit there holding onto the RAM.
Does this mean that ballooning is disabled in VM2?
Yes apologies I should have mentioned in my last post, I disabled ballooning (setting guestmemoryballoon 0) just before I rebooted the VM to grab the log as it was just consuming memory on the guest and seemingly doing nothing else.


I have tried again today to set this up but still haven't been able to get any further. It would be good if someone who has got this working can share some insight into this.