[CentOS-virt] How many virtual guest 'cpus' can a core duo 'quad' core support

Wed Feb 22 17:25:20 UTC 2012
Todd And Margo Chester <toddandmargo at gmail.com>

On 02/21/2012 12:59 PM, James B. Byrne wrote:
> CentOS-6.2
>
> What is the maximum number of cpus can I configure for a
> single vm guest running on a host with this hardware?
>
> # lscpu
> Architecture:          x86_64
> CPU op-mode(s):        32-bit, 64-bit
> Byte Order:            Little Endian
> CPU(s):                4
> On-line CPU(s) list:   0-3
> Thread(s) per core:    1
> Core(s) per socket:    4
> CPU socket(s):         1
> NUMA node(s):          1
> Vendor ID:             GenuineIntel
> CPU family:            6
> Model:                 23
> Stepping:              10
> CPU MHz:               1998.000
> BogoMIPS:              5331.76
> Virtualization:        VT-x
> L1d cache:             32K
> L1i cache:             32K
> L2 cache:              2048K
> NUMA node0 CPU(s):     0-3
>
> I ask this because it occurs to me that I may have missed
> something fundamental respecting the use of the initialism
> CPU vice the term Cores.
>
>

Hi James,

I had a dialog with the KVM developers on the subject.  The answer
is as many as you wish, although performance will suffer if you
assign 100 vcpu to a four core machine.  Here is my notes on the
dialog.

-T


KVM Cores and Hyperthreading explained:

CentOS-virt mailing list:

 > Do you have a rule of thumb as to how many core to assign
 > > to a guest?  For instance, with an Intel x5650 with 6 real
 > > and 12 hyperthreaded cores, how many cores would you assign
 > > to the guest?


_______________________________________________

It fully depends on the load of your guests and how many guests you
want/need to run on a single server.

You need to perform some testing to know what will work the best in
your case. One thing to remember though: In your case, if you create
two guests with 12 virtual CPUs each, and one of them crashes and take
all its 12 virtual CPUs up to 100%, it will essentially take most of
the processing power away from the second guest, leaving the second
guest in a close-to-useless state (depending on your scheduler, but
you get the point). If you on the other hand had assigned 6 cores to
each of them, the second guest would have remained unaffected, since
it just uses the 6 cores with no load. So if your guest will not
utilize the extra CPUs anyway, then don't assign them.

Best regards
Kenni
_______________________________________________



It also depends on what each guest is doing.  Some software, like the
Postfix MTA, has issues with the timer in a VM and in circumstances
like that you want to minimise the number of cores if you can't skip
the use of the VM entirely.

Kenni is right, though, test it and see whatever works best for your
project.

Regards,
Ben
_______________________________________________



You may already know this, but don't rely on hyperthreading giving you 
very much
extra.  At best it's squeezing some useful work out of what would be a 
few idle
cycles waiting for the instruction pipeline to re-fill.  At worst it 
degrades
performance and has been known to be a security hazard.

Therefore, in your given case, think six not twelve.  Common advice is 
to leave
one core for the host OS/scheduler.  Which leaves you with 5 physical 
CPUs to
allocate.

N


_______________________________________________
It's how it works, think of kvm as an application. If you tell that it
should use 4 core it's like if you tell it to use 4 processes or
threads. The host operating system will decide which processor core or
thread to use ...

Cheers,
G