VMware Cloud Community
zpeewee
Enthusiast
Enthusiast
Jump to solution

CPU allocation

hello,

I have a question concerning max CPU allocation.

Suppose i have a server with one quad core CPU, each core running at 2 GHz.

If i create a VM with 1 vCPU, i believe that the VM will not receive more that 2 GHz of CPU resource (i do not see how the core can work in parallel).

If i create a VM with 2 vCPU, the VM will receive a max of 4 GHz of CPU.

A i correct ??

Thanks

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
weinstein5
Immortal
Immortal
Jump to solution

The answers given so far are correct - a virtual cpu is scheduled to a single Hardware Execution Context(HEC) - a physical CPU can present mutiple HECs depending on the number of cores it has or if it is hyperthreaded - so a dual core physical CPU will present 2 HECs - Quad core will present 4 - since a virtual cpu can only be scheduled to single HEC that means it will run only on one core and using your example will get 2 GHz - a dual vcpu VM will have two virtual CPUs and each will run on seperate cores so each vCPU will get 2 GHz while for a total of 4 GHz- so as one of the other posters indicated it will not stack them on to the same core -

If you find this or any other answer usefule please consider awarding points by marking the answer correct or helpful

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

View solution in original post

0 Kudos
3 Replies
khughes
Virtuoso
Virtuoso
Jump to solution

Yes I believe you are correct in your thought process.

  • Kyle

-- Kyle "RParker wrote: I guess I was wrong, everything CAN be virtualized "
Erik_Zandboer
Expert
Expert
Jump to solution

Hi,

Your thoughts are correct. CPUs cannot be "stacked", so a 2 vCPU VM will not be able to run a SINGLE thread at 4GHz, but the total CPU power of the VM WILL be equal to 4GHz (as long as your VM has support for multithread or at least runs enough CPU-consuming threads to fill up both cores).

Just make sure you actually NEED two cores on your VM: creating multi-core VMs will always give some extra overhead when it comes to scheduling; start out with a single vCPU and see how far you get. Do not add the second vCPU unless you 1) actually NEED the extra CPU power, and 2) you are sure that the application using this CPU power is multi-threaded (able to make use of more than one core in parallel).

Visit my blog at http://www.vmdamentals.com
weinstein5
Immortal
Immortal
Jump to solution

The answers given so far are correct - a virtual cpu is scheduled to a single Hardware Execution Context(HEC) - a physical CPU can present mutiple HECs depending on the number of cores it has or if it is hyperthreaded - so a dual core physical CPU will present 2 HECs - Quad core will present 4 - since a virtual cpu can only be scheduled to single HEC that means it will run only on one core and using your example will get 2 GHz - a dual vcpu VM will have two virtual CPUs and each will run on seperate cores so each vCPU will get 2 GHz while for a total of 4 GHz- so as one of the other posters indicated it will not stack them on to the same core -

If you find this or any other answer usefule please consider awarding points by marking the answer correct or helpful

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos