5
1
I have an Ubuntu VM that's thrashing swap due to a small guest memory allocation on a host with lots of free ram. It appears the guest kernel is compiled to support hot-adding RAM, is there way to get virtualbox to mount more ram without shutting down the running VM?
I don't need zero downtime, I can do a state-save, but I don't want have to restart the multi-day processing job in progress on the guest.
Guest is Ubuntu 12.04, Host is OSX 10.7, both x64.
2
While vbox doesn't strictly support memory hot-add, it DOES support ballooning: http://www.virtualbox.org/manual/ch04.html#guestadd-balloon . I would recommend to the OP to restart the VM -- just this once -- and overcommit way more memory than you think you'll need. Vbox should be smart about it and only use that extra memory if the guest demands it. Don't overcommit beyond the physical RAM, but you can go pretty close to physical RAM. Worst case, your host starts swapping, but it'll only start doing that if there is substantial memory pressure on the host, which is usually a good thing.
– allquixotic – 2012-07-10T18:24:36.880@allquixotic, agreed, but that is not the focus of the question (as far as I can tell anyway). If the OP edits/comment to that effect, then I will add this idea to my answer (or feel free to post your own) – soandos – 2012-07-10T18:27:53.770
The guest's swapfile is on an SSD mounted directly to the VM, not a virtual drive, so the host OS doesn't get a chance to cache it. The swapping only happens intermittently, when the guest is serving unrelated requests. This causes the processing to come to a near-halt until the other job finishes, but forward progress is still happening. – BCoates – 2012-07-10T18:33:03.900
@allquixotic, unfortunately the host is OSX. Added that to the question. – BCoates – 2012-07-10T18:47:01.553
@BCoates, if the swapfile in on an SSD, thrashing is basically meaningless, and don't worry about. – soandos – 2012-07-10T19:01:12.730