We help IT Professionals succeed at work.

Understanding vCores and vCPUs

mamelas
mamelas asked
on
Hi there Experts,

I have one Intel Xeon with 4-Cores

Assuming that I assign 4 vCPUs to one VM
and all vCPUs have 100 load this theoretically
would bound all the cores of the Physical CPU?

If 1 Physical core is equal to 1 vCPU
1 vCore is equal to half vCPU or half Physical core?
What is the actual match between Physical and Virtual?

Thanks in Advance,
Mamelas
Comment
Watch Question

VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
1 vCPU = 1 physical core of the physical host processor, (in simplicity!).

BUT, the hypervisor scheduler can move the process from one core to another core, throughout the execution of the VM.

So it might not be the same core all the time.

In your example, if you have a non-hyperthreaded, actual 4 core processor, you will have access to 4 vCPU.

But many VMs can share a core, and you can have 5-6 VMs per physical core of a processor.

vSMP (virtual SMP) can affect virtual machine performance, when adding too many vCPUs to virtual machines that cannot use the vCPUs effectly, e.g. Servers than can use vSMP correctly :- SQL Server, Exchange Server.

This is true, many VMware Administrators, think adding lots of processors, will increase performance - wrong! (and because they can, they just go silly!). Sometimes there is confusion between cores and processors. But what we are adding is additional processors in the virtual machine.

So 4 vCPU, to the VM is a 4 Way SMP (Quad Processor Server), if you have Enterprise Plus license you can add 8, (and only if you have the correct OS License will the OS recognise them all).

If applications, can take advantage e.g. Exchange, SQL, adding additional processors, can/may increase performance.

So usual rule of thumb is try 1 vCPU, then try 2 vCPU, knock back to 1 vCPU if performance is affected. and only use vSMP if the VM can take advantage.

Example, VM with 4 vCPUs allocated!

My simple laymans explaination of the "scheduler!"

As you have assigned 4 vCPUs, to this VM, the VMware scheulder, has to wait until 4 cores are free and available, to do this, it has to pause the first cores, until the 4th is available, during this timeframe, the paused cores are not available for processes, this is my simplistic view, but bottom line is adding more vCPUs to a VM, may not give you the performance benefits you think, unless the VM, it's applications are optimised for additional vCPUs.

See here
http://www.vmware.com/resources/techresources/10131

see here
http://www.gabesvirtualworld.com/how-too-many-vcpus-can-negatively-affect-your-performance/

http://www.zdnet.com/virtual-cpus-the-overprovisioning-penalty-of-vcpu-to-pcpu-ratios-4010025185/

also there is a document here about the CPU scheduler

www.vmware.com/files/pdf/perf-vsphere-cpu_scheduler.pdf

https://blogs.vmware.com/vsphere/2013/10/does-corespersocket-affect-performance.html
As far as I know Hyper-V does not affinitise vCPUs to CPU cores.

We have 8 times more vCPUs than physical cores on two of our machines. Last time I checked the recommendation was maximum 12 vCPUs per core, but that could have changed.

Every single time a thread runs, no matter what it is, it drives the CPU at 100%, and when you see it at 100%, it means that the CPU was completely active across the measured span of time. 20% means it was running a process 1/5th of the time and 4/5th of the time it was idle.
Hyper-V will pre-empt it when it’s another thread’s turn and it is possible to have multiple 100% CPU threads running on the same system and some threads will simply let their time slice go by, freeing it up so other threads get CPU access more quickly.

Hope this helps.

Author

Commented:
Thank you both for your answers!