Monday, March 21, 2011

VirtualBox - High CPU Problem

I've been using Oracle's VirtualBox for several months now. I'm really impressed with this product and it has helped me a lot to rapidly prototype some APEX concepts.

One thing that bothered me when I started using it was that no matter what my virtual machine was doing, VirtualBox was using a lot of the CPU on my laptop. This didn't matter if the virtual machine was idle or doing any processing. After some digging around I found this very helpful post on the Oracle forums: http://forums.oracle.com/forums/thread.jspa?messageID=9305831. As weird as it may sound the suggestion is to create and start a second, dummy, virtual machine. I was pleasantly surprised to see that it worked. The configuration that I used was: DOS as an OS. 4 MB of memory and a 4 MB hard drive. Disable all the extra stuff (network, audio, usb, etc).

Here are the screen shots of my CPU before and after I started the second, dummy, virtual machine:

Before:

After:

After starting the second virtual machine the CPU spiked for a few seconds then dropped significantly. Hopefully this issue will be fixed in a future version of VirtualBox but until then this is a very simple work around.

10 comments:

  1. Good find Martin! I have never seen a performance problem with my Virtualbox on my laptop (i-720, 8gigs), but now I will look at the monitor to validate your findings.

    Wayne

    ReplyDelete
  2. I did not encounter this issue on an i-720 Win7 64bit host (8cpu,8gigs). But I did see it on a Pentium 4 (2cpu,3gigs) 32-bit host running CentOS 5.

    It's either a bug when running on a Linux host, or a bug on a "smaller" machine (ie 2 cpu).

    I applied the dummy machine suggestion and my CPU dropped significantly. Now it is actually usable!

    Wayne

    ReplyDelete
  3. ... oh, and by the way, when I tested on my i720 laptop, I had 3 VMWare virtual machines running as well as the Virtualbox EL5 guest running. All four were running with 2gig memory, 2cpus. Not doing much mind you, but running just the same.

    Wayne

    ReplyDelete
  4. Doesn't work for me, I can still see high CPU even of I create a dummy machine and start it

    ReplyDelete
  5. You may need to contact the VirtualBox team for additional support. Hopefully we won't see this issue in the next major release.

    ReplyDelete
  6. Version 4.1 may resolve this issue. Please read the 4.1 beta release notes: http://forums.virtualbox.org/viewtopic.php?f=15&t=42688

    ReplyDelete
  7. Nothing helped me except for disabling nested paging. System > Acceleration > untick enable nested paging. Using VB 4.1 on win 7 64, i7 8 gb vaio

    ReplyDelete
  8. Thanks a lot Anonymous! I banged my head flat for a couple of month, unsuccessfully tried almost every workaround that's found on the net.

    Testing dummy vms, VB versions from 3.2 to 4.1, changing of timers and some kernel parameters, number of cores, starting VMs in different orders/ways etc.

    Disabling nested paging solved it for me instantly.

    Thanks again, you saved my day (and month)!

    ReplyDelete
  9. Another way to kill your host with high cpu load, when running multiple virtualbox machines:

    “bridge a lot lof network interfaces”

    Try disabling bridges and think again about any bridged network loops that might have existed.

    ReplyDelete
  10. I was getting 15-20% CPU utilization from Ubuntu 12.04 guests on OS X and none of the existing suggestions helped, but I did manage to fix it, added the details to the SuperUser Q&A: http://superuser.com/a/722446/113572

    ReplyDelete