This discussion is archived
12 Replies Latest reply: Mar 21, 2011 9:45 AM by Martin Giffy D'Souza RSS

Why is VM virtualbox consuming so much cpu all the time?

ToonKoppelaars Employee ACE
Currently Being Moderated
Hello again,

I installed Oracle VM virtualbox, with the developerdays appliance that is downloadable from otn, on my laptop (Windows7 64 bit). What I now notice is that whenever the 'developerdays' virtual machine is running, an image called VirtualBox.exe is consuming 80% of one of the cores in the laptop. This is going on inside my host OS (Windows7) while absolutely nothing is going on inside the VM host.

Why is this?

I was using VMware up to now, and this wasn't happening with VMware: when the VM host was doing nothing, no cpu was being used by VMware.

Can this be fixed? Or is this just how Virtualbox operates?

Thanks,

Toon
  • 1. Re: Why is VM virtualbox consuming so much cpu all the time?
    msadiq Newbie
    Currently Being Moderated
    Hi

    I am also running solaris 10 in virtual box and when it is idle it shows me 0 % of cpu utilisation , Please check if there is any background process or some daemon is taking the cpu utilisation . you can check the process using

    # prstat -a

    Regards
    Sadiq
  • 2. Re: Why is VM virtualbox consuming so much cpu all the time?
    ToonKoppelaars Employee ACE
    Currently Being Moderated
    The downloaded VM is a Linux OS in virtual box. And really nothing is running inside that OS.
    prstat seems to be Solaris specific as it says:
    [oracle@localhost ~]$ prstat -a
    bash: prstat: command not found
    But as I mentioned before: nothing is running in the Linux environment that is consuming cpu.
    Here's a vmstat of 10 seconds:
    [oracle@localhost ~]$ vmstat 1 10
    procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
     0  0      0  97520  34224 681120    0    0  1336   107 1093  537  6 15 78  1  0
     0  0      0  97520  34224 681120    0    0     0    32 1026  422  1  2 97  0  0
     0  0      0  97520  34228 681120    0    0     0    32 1005  389  1  1 98  0  0
     0  0      0  97520  34236 681112    0    0     0    24 1025  418  1  2 97  0  0
     0  0      0  97520  34236 681120    0    0     0    32 1006  402  1  2 97  0  0
     0  0      0  97520  34236 681120    0    0     0     0 1030  394  0  1 99  0  0
     0  0      0  97520  34236 681120    0    0     0     0 1001  363  1  2 97  0  0
     0  0      0  97520  34236 681120    0    0     0    32 1022  418  1  1 98  0  0
     1  0      0  97520  34244 681120    0    0     0    40 1007  401  0  1 99  0  0
     0  0      0  97520  34244 681120    0    0     0     0 1023  409  1  2 97  0  0
    [oracle@localhost ~]$ 
    Yet the "box-software" is consuming cpu when looking at it from Windows: every 4-5 seconds it peaks to 80% usage of one of the cores.
    Here it is (using typeperf), VirtualBox.exe was using cpu of core number 4 all the time:
    C:\Windows\system32>typeperf "\processor(4)\% processor time"
    
    "(PDH-CSV 4.0)"
    "01/09/2011 11:38:20.842","42.344613"
    "01/09/2011 11:38:21.843","33.028546"
    "01/09/2011 11:38:22.846","61.160062"
    "01/09/2011 11:38:23.885","80.455370"
    "01/09/2011 11:38:24.887","71.965438"
    "01/09/2011 11:38:25.888","90.650478"
    "01/09/2011 11:38:26.890","78.195341"
    "01/09/2011 11:38:27.891","48.577628"
    "01/09/2011 11:38:28.893","39.319037"
    "01/09/2011 11:38:29.895","50.160778"
    "01/09/2011 11:38:30.897","92.216508"
    "01/09/2011 11:38:31.900","89.108545"
    "01/09/2011 11:38:32.901","87.540195"
    "01/09/2011 11:38:33.903","79.752816"
    "01/09/2011 11:38:34.905","70.422727"
    "01/09/2011 11:38:35.907","34.586022"
    "01/09/2011 11:38:36.909","31.505269"
    "01/09/2011 11:38:37.917","72.132391"
    "01/09/2011 11:38:38.929","75.411832"
    "01/09/2011 11:38:39.945","89.216115"
    "01/09/2011 11:38:40.953","72.173823"
  • 3. Re: Why is VM virtualbox consuming so much cpu all the time?
    173188 Newbie
    Currently Being Moderated
    There is a commonly reported problem with RHEL derived distributions in relation to the speed that the kernel runs at (if you google 'virtualbox rhel high cpu utilisation' you will find lots of info that explains it.)

    I hadn't noticed the high CPU until I read your message, but found it was running at ~50+% when idle. The following change reduced this to ~8%. I have had to do this before when installing Centos5.5 and Oracle EL in VirtualBox. You haven't said which version of VBox you are using but I have experienced the problem in several versions and it is present in the latest V4.0

    In short the fix is this :

    Open terminal
    Switch to su (enter command 'su' followed by password 'oracle' when prompted)
    Run command : cat /etc/grub.conf
    In the output you should see the following lines :
    .........................
    hiddenmenu
    title Enterprise Linux Enterprise Linux Server (2.6.18-194.0.0.0.4.el5)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-194.0.0.0.4.el5 ro root=LABEL=/ rhgb quiet
    initrd /boot/initrd-2.6.18-194.0.0.0.4.el5.img
    title Enterprise Linux Enterprise Linux Server (2.6.18-164.15.1.0.1.el5)
    etc...................

    You need to add the text 'divider=10' to the line beginning 'kernel /boot/vmlinuz.......etc.....'
    To do this enter command 'gedit /etc/grub.conf' - you may seem some odd message after this, just ignore it, gedit will open the file for editing.
    Find the line above and amend, the lines shown above should look like this after editing :
    .........................
    hiddenmenu
    title Enterprise Linux Enterprise Linux Server (2.6.18-194.0.0.0.4.el5)
    root (hd0,0)
    *kernel /boot/vmlinuz-2.6.18-194.0.0.0.4.el5 ro root=LABEL=/ rhgb quiet divider=10_*
    initrd /boot/initrd-2.6.18-194.0.0.0.4.el5.img
    title Enterprise Linux Enterprise Linux Server (2.6.18-164.15.1.0.1.el5)
    etc...................

    Save the file and exit.
    Exit terminal and reboot VM.

    Hopefully you will experience the same CPU drop that I did.

    Rgds
    Robert
  • 4. Re: Why is VM virtualbox consuming so much cpu all the time?
    Avi Miller Guru
    Currently Being Moderated
    rbrooke wrote:
    There is a commonly reported problem with RHEL derived distributions in relation to the speed that the kernel runs at (if you google 'virtualbox rhel high cpu utilisation' you will find lots of info that explains it.)
    Another option is to use Oracle Linux and the Unbreakable Enterprise Kernel instead. We have configured that kernel to be tickless, which means it is no longer a 1000hz kernel, but rather only throws interrupts on request.
  • 5. Re: Why is VM virtualbox consuming so much cpu all the time?
    ToonKoppelaars Employee ACE
    Currently Being Moderated
    Avi Miller wrote:
    rbrooke wrote:
    There is a commonly reported problem with RHEL derived distributions in relation to the speed that the kernel runs at (if you google 'virtualbox rhel high cpu utilisation' you will find lots of info that explains it.)
    Another option is to use Oracle Linux and the Unbreakable Enterprise Kernel instead. We have configured that kernel to be tickless, which means it is no longer a 1000hz kernel, but rather only throws interrupts on request.
    Isn't that kernel used then by the VM I downloaded from otn? Why would Oracle not do that?

    (sorry database guy here, not os....)
  • 6. Re: Why is VM virtualbox consuming so much cpu all the time?
    Avi Miller Guru
    Currently Being Moderated
    Toon Koppelaars wrote:
    Isn't that kernel used then by the VM I downloaded from otn? Why would Oracle not do that?
    I believe those templates were built before we released the UEK. I know that most of the current Oracle VM Templates also use the RHEL5-compatible kernel as they were built prior to the release of the UEK. I believe that new templates may ship with the UEK enabled by default, but I haven't seen those yet. :)
  • 7. Re: Why is VM virtualbox consuming so much cpu all the time?
    ToonKoppelaars Employee ACE
    Currently Being Moderated
    Using google, one of the possible solutions I found, was to just create a 2nd VM, next to the 'developerdays' VM that I downloaded.

    So I did that. A 2nd VM (windows XP) without any boot device. Started it. And the problem was gone.
  • 8. Re: Why is VM virtualbox consuming so much cpu all the time?
    ToonKoppelaars Employee ACE
    Currently Being Moderated
    Is it difficult to configure it tickless by yourself?
    Can I verify in some way that it is indeed not tickless?
  • 9. Re: Why is VM virtualbox consuming so much cpu all the time?
    Avi Miller Guru
    Currently Being Moderated
    Toon Koppelaars wrote:
    Is it difficult to configure it tickless by yourself?
    You would have to recompile the kernel which is not supported by Oracle. The simplest option is just to upgrade to the UEK which is tickless by default.
    Can I verify in some way that it is indeed not tickless?
    Take a look at /boot/config-`uname -r` which shows you the kernel configuration options for the currently running kernel. If you find CONFIG_NO_HZ=y it means the kernel is set to be tickless. This should be visible in the config for 2.6.32 (UEK) but not in the RHEL5 (2.6.18) kernels.
  • 10. Re: Why is VM virtualbox consuming so much cpu all the time?
    ToonKoppelaars Employee ACE
    Currently Being Moderated
    Thanks Avi.
    Any luck you can assist me with the other question I posted (ssh access denied from host OS to VM)?
  • 11. Re: Why is VM virtualbox consuming so much cpu all the time?
    Martin Giffy D'Souza Oracle ACE Director
    Currently Being Moderated
    I did what Toon suggested. You can even chose a DOS as an OS type and use 4 MB of memory and a 4 MB hard drive. Disable all the extra stuff (network, audio, usb, etc) and run it. You'll notice your CPU drop substantially.

    See: http://superuser.com/questions/131646/why-does-virtualbox-use-15-20-cpu-when-vm-is-paused

    Martin
    -----
    http://www.talkapex.com
  • 12. Re: Why is VM virtualbox consuming so much cpu all the time?
    Martin Giffy D'Souza Oracle ACE Director
    Currently Being Moderated
    I wrote a small blog post on this showing the difference of CPU utilization before and after: http://www.talkapex.com/2011/03/virtualbox-high-cpu-problem.html

    Martin
    -----
    http://www.talkapex.com

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points