VirtualBox only uses maximum 50% CPU

Discussions related to using VirtualBox on Windows hosts.
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

VirtualBox only uses maximum 50% CPU

Post by chinhodado »

On my machine, VirtualBox never uses more than 50% CPU no matter how demanding the task in the Guest is.

When the guest CPU usage reaches 100%, the CPU usage in the host is only 50%

My machine is i7-2600 (4 cores, 8 threads).
In my VM setting I have set the number of processor to 4 (maximum in the green range).
Execution cap is 100%
PAE/NX is enabled
VT-x is enabled, Nested Paging is enabled
Host: Windows 7 x64, Guest: Fedora 20 x64

How can I fix this? I want to utilize 100% of my machine's CPU.
Attachments
Windows task manager
Windows task manager
windows.PNG (49.01 KiB) Viewed 12854 times
Fedora system monitor
Fedora system monitor
fedora.PNG (37.08 KiB) Viewed 12854 times
Reinderien
Posts: 21
Joined: 17. Sep 2009, 09:43
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: VirtualBox only uses maximum 50% CPU

Post by Reinderien »

Have you tried doubling the number of CPUs assigned to the guest? Even though your CPU may have 4 cores, to Linux I believe it should look like 8 due to Hyperthreading.
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

Re: VirtualBox only uses maximum 50% CPU

Post by chinhodado »

I can set the number of processors up to 8, but if I set it more than 4 VirtualBox will display a warning:
Invalid settings detected: More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (4). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs
Reinderien
Posts: 21
Joined: 17. Sep 2009, 09:43
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: VirtualBox only uses maximum 50% CPU

Post by Reinderien »

Try it anyway.
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

Re: VirtualBox only uses maximum 50% CPU

Post by chinhodado »

I tried it, and it does work (the CPU usage is now more than 50%). However isn't it discouraged by VirtualBox? I mean, if I can just do it without any drawbacks, what's the point of the warning?
Reinderien
Posts: 21
Joined: 17. Sep 2009, 09:43
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: VirtualBox only uses maximum 50% CPU

Post by Reinderien »

I think that the warning is bogus.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VirtualBox only uses maximum 50% CPU

Post by Perryg »

Not bogus. It is there to prevent you having issues with the host. It says warning not fatal.
Once you have an issue with over-committing the CPU you will understand and heed the warning.
Reinderien
Posts: 21
Joined: 17. Sep 2009, 09:43
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: VirtualBox only uses maximum 50% CPU

Post by Reinderien »

I agree that over-committing your CPU is an issue, but in this case, vbox is incorrectly assuming that your capacity for concurrent threads is equal to your core count, and this is clearly not the case with Hyperthreading. You could even set the CPU count to 7, trigger the warning, and it would be physically impossible to pin the CPU at 100%.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox only uses maximum 50% CPU

Post by noteirak »

The green mark is set to your physical cores, they are the only thing that truely matter in the end.
The orange mark is set to your logical cores, because they share ressources with the physical cores, and therefore it's never truely possible to run two things totally unrelated at the same time on these.
The red mark is the additions of the two, and is clearly over-commitement.

The matter is not how much of CPU% you reach, but how busy you keep your CPU by switching contexts and the likes. So going above your physical cores is always a bad idea if you know you'll do intensive tasks.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

Re: VirtualBox only uses maximum 50% CPU

Post by chinhodado »

Sorry, is this orange or red?

Image

Also, are you saying that even though the CPU utilization is higher (by selecting more cores), the performance is not actually better? That seems counter-intuitive.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VirtualBox only uses maximum 50% CPU

Post by Perryg »

VirtualBox deals with physical cores. Hyper-threads ( SMT ) are not cores, but appear as cores due to the way they are implemented. Adding yet another outlet to a pipeline does not mean you have additional cores, just paths to the core/s that you do have.
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

Re: VirtualBox only uses maximum 50% CPU

Post by chinhodado »

So you mean this is true?
even though the CPU utilization is higher (by selecting more cores), the performance is not actually better?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: VirtualBox only uses maximum 50% CPU

Post by Perryg »

To a point yes. The overhead of adding a core quickly becomes more than the advantage. The only way to find the optimal setting for your PC is to test adding one at a time and use a stop watch to see when degradation happens. Monitors ( such as are shown above ) are not accurate when used in/with virtualization.

Now when you add threads you are telling VBox to use the same core twice and that can cause issues since VBox does not use HT ( hypter-threads ). Intel even tells you that you should disable HT on units that do not use them. Do some reading about HT's and you will see what I am talking about.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VirtualBox only uses maximum 50% CPU

Post by socratis »

chinhodado wrote:So you mean this is true?
even though the CPU utilization is higher (by selecting more cores), the performance is not actually better?
Well, yes and no. I did a little test a while back with a number crunching program. The performance was more or less linear. But there was no other I/O. You can read all about it here: viewtopic.php?f=1&t=59259&start=15
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
chinhodado
Posts: 9
Joined: 10. Feb 2014, 21:14
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Fedora 20

Re: VirtualBox only uses maximum 50% CPU

Post by chinhodado »

socratis wrote:
chinhodado wrote:So you mean this is true?
even though the CPU utilization is higher (by selecting more cores), the performance is not actually better?
Well, yes and no. I did a little test a while back with a number crunching program. The performance was more or less linear. But there was no other I/O. You can read all about it here: viewtopic.php?f=1&t=59259&start=15
So according to your result, the performance will linearly increase as the number of cores approaches the number of logical cores on your machine right? That's what I think as well.
One more thing: on your machine, do you have the green bar all the way up tp 8 cores? Or just to 4 like on my machine?
Post Reply