VMware Cloud Community
joms_marino
Contributor
Contributor

CPU Logical Processors

Hi Everyone,

A pleasant day to you all!

I have a client who is asking bout the cpu processors, how it can be shared within the VMs they created. For example, I have 2 way quad core intel processors, so it means that logically I have 8 processors. Now how many virtual processors I can create on this number of logical processors.

In addition, since vmware has a feature of vSMP wherein you can create up to four virtual processors, but the physical processors I have is only 1 way dual processors. Now my client ask can I still create 4 vCPU on a VM?

Hoping for your immediate response on my queries..

Thanks!

Joms

0 Kudos
17 Replies
madda
Hot Shot
Hot Shot

You can technically create as many virtual processors as you want, but there will be slowdowns due to the way that cpu time is allocated.

Basically if a VM has 4 vCPUs assigned, then it will only get CPU time when 4 logical CPUs are free which leaves only 4 logical CPUs for all the other VMs. Generally it is better to assign fewer vCPUs initially and scale up if you really need to afterwards.

Think of your 8 logical CPUs like chairs, if a VM has 4 vCPUs then 4 chairs are used and there are only 4 that the other VMs can use during that instruction period. Obviously that 4 vCPU VM doesn't constantly take up those 4 logical processors, as it changes every few milliseconds, but if a VM has 4 vCPUs then it has a higher shares value (basically priority) due to it needing more resources to run. Using that many vCPUs can lead to high CPU ready time if not properly managed.

----- Mark Atherton
0 Kudos
joms_marino
Contributor
Contributor

Hi Madda,

Sorry for being so naive, but what do you mean by CPU time?

For best practice, how many virtual processors can I create on (1) logical processor?

Regards,

Joms

0 Kudos
madda
Hot Shot
Hot Shot

The time a virtual machine waits in the queue in a ready-to-run state before it can be scheduled on a CPU is known as ready time.

----- Mark Atherton
0 Kudos
Erik_Zandboer
Expert
Expert

Hi Joms,

A nice rule-of-thumb is to assign 4 vCPUs per physical core. No guarantees though, if you have VMs that are number crunchers you might saturate your physical CPUs on two vCPUs per core. On the other hand, I have seen customers using 8 or even 10 vCPUs per core (lightweight XP desktops).

Another rule-of-thumb is to always assign single vCPUs to a VM as a start. Think really well before adding a second vCPU. If you plan to add another vCPU to a VM, making it a "dual CPU" VM, make sure your application running within the VM is able to use multiple CPUs (multi-threaded apps), and also that you have (preferably much) more logical cores than you assign vCPUs to your VMs. For example, NEVER create a 4 vCPU VM if your physical ESX node has only two dual-core CPUs. That schedules really bad on ESX. Also, the service console is locked down to core0. So if you have a 4 vCPU VM on a 4-core system, the VM can never run faster than whatever is "left" on core0....

Visit my blog at http://www.vmdamentals.com
0 Kudos
joms_marino
Contributor
Contributor

Hi Erik,

Thanks for your response, if I may ask how can I assign "<span class="jive-thread-reply-body-container">4 vCPUs per physical core".

<span class="jive-thread-reply-body-container">For example, NEVER create a 4 vCPU VM if your physical ESX node has only two dual-core CPUs. - but it still possible to do this?

Again thanks Erik!

Regards,

Joms

0 Kudos
Erik_Zandboer
Expert
Expert

Hi,

You should be able to assign 4 vCPUs to a VM from its settings (when it is powered off). You obviously need at least 4 logical cores in your ESX host to perform this (a 4 vCPU virtual machine can never run if there are not at least 4 logical cores available at the same time).

Yes - You can assign 4 vCPUs to a VM if you have for instance a 2x dualcore or a 1x quadcore CPU system. Not recommendable though. It is guaranteed that you will run into serious performance issues.

Visit my blog at http://www.vmdamentals.com
0 Kudos
madda
Hot Shot
Hot Shot

You can't assign 4 vCPUs to a single logical processor, it still requires 4 logical CPUs for that to run on.

It is still possible t create a 4 vCPU VM with only 2 dual core CPUs, but it is not recommended at all. Basically you will have slow downs on other VMs on that server.

----- Mark Atherton
0 Kudos
Erik_Zandboer
Expert
Expert

Madda,

Not entirely. If you choose to run a 4 vCPU VM on an ESX host with only 4 logical cores, it will only run when ALL cores are available. Since the service console is locked to core 0, the 4vCPU VM can only run when the service console is not (needs core 0 as well to be able to run!). So basically this setup will leave all CPU cycles taken on core0 available on the other cores, in which the other (single vCPU) VMs can run. It would be specifically desastrous on the 4 vCPU VM though: As soon as any other VM (including the SC) is using CPU cycles from any core, the 4 vCPU VM cannot and will halt.

Any which way you look at it, it is ESX performance killer no 1. Don't ever!

Visit my blog at http://www.vmdamentals.com
0 Kudos
TomHowarth
Leadership
Leadership

>You can technically create as many virtual processors as you want, but there will be slowdowns due to the way that cpu time is allocated.

Not exactly true, there is a maximum per host and that is currently 192 it was raised from 128 in ESX3.5 U1

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

Tom Howarth

VMware Communities User Moderator

Blog: www.planetvm.net

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
TomHowarth
Leadership
Leadership

Thanks for your response, if I may ask how can I assign "<span class="jive-thread-reply-body-container">4 vCPUs per physical core".

You can't each vCPU required a pCPU or pCore to run against, therefore if you have a dual single core machine the maximum sized SMP guest you could run is a 2vCPU machine. (I would not however recommend it as performance would be woeful)

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

Tom Howarth

VMware Communities User Moderator

Blog: www.planetvm.net

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
TomHowarth
Leadership
Leadership

Eric that was not the question the Original poster asked. He asked if you could run a 4vCPU machine against a single Core. not against a single CPU with multiple cores.

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

Tom Howarth

VMware Communities User Moderator

Blog: www.planetvm.net

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
Erik_Zandboer
Expert
Expert

Sorry Smiley Happy Missed the "one way dual" part....

When using only one-way dual CPUs (like my whiteboxes Smiley Wink ), you are basically stuck with single vCPU VMs if you want any performance.

Visit my blog at http://www.vmdamentals.com
0 Kudos
madda
Hot Shot
Hot Shot

Yes that is your only option if you want any decent performance

----- Mark Atherton
0 Kudos
monisiqbal
Enthusiast
Enthusiast

I know this is a bit too late (2 years) to respond to the discussion but this comment created some confusion for me.

No matter what the virtual processors limit is you cannot assign virtual CPUs greater than the number of logical processors on the hypervisor, right?

0 Kudos
ThompsG
Virtuoso
Virtuoso

Within a VM you cannot assign more vCPU's than you have logical processors up to a maximum of 4 for ESX3.5.

If you have multiple VMs then the total number of vCPUs (i.e. add up all the vCPUs in all the running VMs on the server) is limited by the maximums posted here: http://www.vmware.com/pdf/vi3_35/esx_3/r35u2/vi3_35_25_u2_config_max.pdf

Trust this helps and doesn't create more confusion.

Kind regards.

0 Kudos
Erik_Zandboer
Expert
Expert

Hi,

There are two very different things - You can assign a number of vCPUs to a single VM, or you can use a number of vCPUs running over different VMs.

The number of vCPUs per VM is dependent on the number of logical CPUs in the system. If you have a single socket quad core CPU you cannot assign more vCPUs in a single VM than 4. But nothing keeps you from having 16 VMs with a single vCPU each. In this case you use 16 vCPUs while you only have 4 physical cores available.

The limit here is that a single VM needs all of its vCPUs to be scheduled in parallel on the host. But several VMs running can time-share a limited number of cores...



Visit my blog at http://www.vmdamentals.com

Visit my blog at http://www.vmdamentals.com
0 Kudos
monisiqbal
Enthusiast
Enthusiast

Thanks a lot Glen and Erik, confusion sorted out.

0 Kudos