Monday, April 2, 2012

Virtualization Performance with Ubuntu and VMWare or Virtualbox

I've been using Linux as my primary OS for a couple of years not.  However, as a network guy I still need a windows box around for various tasks.  Mostly because the company I work for uses GoToMeeting online data conferencing and they lack Linux support.

I've found using a Virtual install of Windows to work  best for my needs.  A couple of months ago I built a new Windows 7 virtual install but it suddenly slowed to a crawl!  When I first built the box it would boot up to the login prompt in about 30 seconds.  More recently it was was taking more like 5 minutes to boot up.  And when it was my entire host Linux box was slowed down as well.  I noticed that disk utilization was through the roof when this was happening.

Further inspection showed that the host was swapping to the disk like crazy while the VM Windows install was booting up.  The swapping combined with the disk access of the VM overloaded the physical disk system and brought everything down with it.   I've got 4 GB of ram on the system, so I should be able to run the VM with a couple of gigs so RAM and still have enough left over for the host.

The solution to the issue was to decrease the swappiness of the host system.

sudo sysctl vm.swappiness=10
The swappiness setting effects the algorithm that controls when memory is swapped to disk.  The default value on Ubuntu systems is set to 60.  I lowered it down to 10 and have seen a HUGE performance improvement when running the VM!  I've since verified that that work with VMWare or Virtualbox.

Please the SwapFAQ article for more information.