Re: VirtualBox multi cpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2011-03-24 at 08:47 +0100, Luc MAIGNAN wrote: 
> Yes, indeed....
> 
> I've modified the number of cpus via the command line :
> 
> VBoxManage modifyvm MyVM --cpus x
> 
>  From 3 cpus, the performances go down... But I don't really understand 
> why... If someone can give me ways of explanations...

Sure...! This has to do with the way hypervisor schedulers work with
virtual SMB. In your case, the VM you are running may simply not need or
use more than 2 CPU cores, or assigning 3 or more cores causes the
scheduler to have to prioritize things in a less efficient way. Perhaps
both are happening as well. Here's how this works:

Basically, a multi-vCPU VM has to be scheduled for the same number of
CPU cores for every CPU cycle (2 vCPUs, 2 cores; 3 vCPUs, 3 cores; and
so forth). And this part is absolutely key: This gets done regardless of
if there is actually anything for these cores to do.

So, if you have a 4 vCPU VM that only has work to do for a single core,
you still have to schedule 4 cores - of which 3 cores will be scheduled
to basically do ...NOTHING! These cores cannot be used to perform other
work during this time.

I hope you can see that scheduling CPU cores to do nothing could cause a
performance decrease. You basically are forcing the scheduler to choose
which will do nothing as well. Further, scheduling vCPUs in odd numbers
(like 3 vCPUs on a quad-core processor) causes other effects on
performance due to scheduling conflicts. Say, for example, I have a 3
vCPU VM and a 2 vCPU VM running on a quad-core processor. I can never
schedule these two to execute at the same time because I don't have
enough cores.

So, the general rule of thumb for how many vCPUs you need on a VM goes
something like this:

Highly threaded systems and applications will tend to need - and use -
more cores, so configure more vCPUs for them. Things that tend to be
heavy on calculations will tend to need fewer cores. Also, configure
your VMs taking the total number of cores you have on the system into
account so as to minimize possible scheduling conflicts. I usually use
multiples of 2 vCPUs (1, 2, 4, 8) and avoid odd numbered vCPU
configurations. That's especially true on quad-core processors. Six-core
processors give you a little more flexibility (you could do combinations
of 1, 2, 4, 6), but the same general rule still applies.

In any case, make sure you understand the actual CPU needs of the system
and application you are running. I have seen a single vCPU VM use more
processor time on a dual-socket, quad-core box than an 8-way VM running
on the same machine at the same time. In that case, the 8-way VM was
happy as a clam because it wasn't that busy, but the single vCPU VM was
redlining the processor because it wanted even more than what physical
resources were available.

Hope that helps explain things for you!

Chris


-- 

==============================
"If you are calm while all around you is chaos,
then you probably haven't fully understood
the magnitude of the situation."

--Unknown

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux