VMware Cloud Community
AllBlack
Expert
Expert

vCPU - how does it really work?

hi there,

We are looking at virtualizing a DB server. The product vendor seems to be a bit anxious to do this.

The DB is postgres by the way.

Can someone tell me how it works in this situation:

I have two quad core CPU on the ESX server and my VM has two vcpu. How do the virtual cpus relate ro the physical and logical cores

and how do they use them?

I personally never had to create a VM that required more than one CPU so my knowledge us not up to scratch.

If you have an easy to understand document let me know. I would like to understand how logical cpu schedule their resources

etc.

Please consider marking my answer as "helpful" or "correct"
Reply
0 Kudos
6 Replies
malaysiavm
Expert
Expert

vCPU did have the relation tie together with the physical number of cores on your current CPU in the ESX servers. In most of the case, I will suggest to keep it by default, unless you would need further performance tuning, you can select specify cores to handle the Vcpu on your VM, as well as the change on the share value, resource allocation and reservation.

Malaysia VMware Communities -

Craig vExpert 2009 & 2010 Netapp NCIE, NCDA 8.0.1 Malaysia VMware Communities - http://www.malaysiavm.com
Reply
0 Kudos
Texiwill
Leadership
Leadership

Hello,

Per time slice for each VM, there is a 1 to 1 mapping between vCPU and Core.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

SearchVMware Blog: http://itknowledgeexchange.techtarget.com/virtualization-pro/

Blue Gears Blogs - http://www.itworld.com/ and http://www.networkworld.com/community/haletky

As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Ken_Cline
Champion
Champion

I have two quad core CPU on the ESX server and my VM has two vcpu. How do the virtual cpus relate ro the physical and logical cores and how do they use them?

Each vCPU is (more or less) equivalent to one pCore. The vmkernel will try to coschedule all vCPUs for a given VM on the same physical socket in order to maximize cache utilization. Your VM will see that it has two CPUs and will see the actual physical processor, so, in your case, it will show that it has two quad-core CPUs; however, it will have access to only two core's worth of capacity.

I personally never had to create a VM that required more than one CPU

This is true for many people - you're just one of the few who has actually done what they should have done and truly allocated only one vCPU Smiley Wink

Ken Cline

Technical Director, Virtualization

Wells Landers

TVAR Solutions, A Wells Landers Group Company

VMware Communities User Moderator

Ken Cline VMware vExpert 2009 VMware Communities User Moderator Blogging at: http://KensVirtualReality.wordpress.com/
AllBlack
Expert
Expert

Thanks Ken,

In this situation, the VM would be the only one on the ESX box (for starters anyway).

So this means that 6 out of 8 logical would be unused?

And if my VM performs poorly I would need to add more vCPU because the

original 2 vCPU would not be able to use more logical cores?

Is that right?

cheers

Please consider marking my answer as "helpful" or "correct"
Reply
0 Kudos
Ken_Cline
Champion
Champion

In this situation, the VM would be the only one on the ESX box (for starters anyway).

So this means that 6 out of 8 logical would be unused?

By VMs, yes. There is always some overhead capacity used by the vmkernel to manage the environment - but in general, you're right.

And if my VM performs poorly I would need to add more vCPU because the original 2 vCPU would not be able to use more logical cores?

Correct. A single vCPU can NEVER use more than a single pCore's worth of capacity.

Ken Cline

Technical Director, Virtualization

Wells Landers

TVAR Solutions, A Wells Landers Group Company

VMware Communities User Moderator

Ken Cline VMware vExpert 2009 VMware Communities User Moderator Blogging at: http://KensVirtualReality.wordpress.com/
Reply
0 Kudos
kuanjohn
VMware Employee
VMware Employee

I understand this threat is quite old and hope that people here still around.

Does this 1vCPU map to 1pCPU still apply in vSphere 4.1?

Let's take a look in this example, assuming the application can understand multi-thread or multi-core processing.

What if the physical host has 32 cores processor (eg. 2Ghz each core). Can the VM (with 8 vCPU assigned) improved performance by utilizing the rest of the 24 available cores or it will always tide 1vCPU with 1 core/pCPU at any time? Assuming there is only 1VM running in this physical host. Can the VM run more than 16 Ghz (8 vCPU x 2Ghz) in total at any one time?

Regards,

J.

Reply
0 Kudos