VMware Cloud Community
evanc4
Contributor
Contributor
Jump to solution

Need help understanding optimal vcpu, core, and socket

Hello, sorry for the 101 question but I am having difficulty understanding the proper CPU assignment for an ESXi VM.  I read the article below but I am still not getting it.

https://kb.vmware.com/s/article/1010184

So to get to the point, I have a Xeon D-1557 SoC CPU with 12 cores and 24 threads which, if I understand correctly, gives me 288 vCPUs to work with.  When editing a VM, what I don't understand is if I wanted to give a VM 8 vCPUs (so like the guest OS would see 4 cores, 8 threads), do I set CPU to 4 or 8?  Do I set cores per socket to 1, 2, 4, or 8?

I only have 5 VMs running so far and they have been set up as 2 CPU, 2 cores per socket.  Is this the correct way?

Also does it matter if I enable the option for "Expose hardware assisted virtualization to the guest OS" or "Expose IOMMU to the guest OS" in this case?  To my understanding, both cannot be enabled simultaneously so this is just a question of if one or the other needs to be enabled.

Do I need to set anything with Scheduling affinity?

Reply
0 Kudos
1 Solution

Accepted Solutions
Tibmeister
Expert
Expert
Jump to solution

What's worked for me for many moons is the following:

  • Start small, 2 vCPU to start with
  • Only ever use 1 Core per Socket, let vNUMA do it's thing
  • Turn off CPU and Memory Hot Add, it's more trouble than it's worth
  • Watch performance over several days and use 95th percentile to remove spikes
  • Consider CPU usage from the hypervisor's perspective, not the Guest OS perspective
  • Use VMXNET3 and Paravirtual adapters when possible
  • Don't be afraid of a VM running between 70% and 80% at all times, a busy VM is an efficient VM
  • Watch CO-STOP, RDY, and IO-WAIT and size accordingly
  • Most importunately, understand your workload!!!!!

View solution in original post

6 Replies
RajeevVCP4
Expert
Expert
Jump to solution

here thread means how much instruction execute in one time its not related with VCPU

for better understanding please go though this KB

 

https://blogs.vmware.com/customer-experience-and-success/2021/06/sockets-cpus-cores-and-threads-the-...

 

 

 

 

 

 

 

Rajeev Chauhan
VCIX-DCV6.5/VSAN/VXRAIL
Please mark help full or correct if my answer is use full for you
evanc4
Contributor
Contributor
Jump to solution

Thanks for the reply.  I went through the article so it seems I misused vCPU in my question.  So in my use case, I still don't know what to set the CPU and socket as in the VM config for optimization.

Reply
0 Kudos
RajeevVCP4
Expert
Expert
Jump to solution

https://blogs.vmware.com/performance/2017/03/virtual-machine-vcpu-and-vnuma-rightsizing-rules-of-thu....

 

Your all question's answer in this blog

 

 

Rajeev Chauhan
VCIX-DCV6.5/VSAN/VXRAIL
Please mark help full or correct if my answer is use full for you
Tibmeister
Expert
Expert
Jump to solution

What's worked for me for many moons is the following:

  • Start small, 2 vCPU to start with
  • Only ever use 1 Core per Socket, let vNUMA do it's thing
  • Turn off CPU and Memory Hot Add, it's more trouble than it's worth
  • Watch performance over several days and use 95th percentile to remove spikes
  • Consider CPU usage from the hypervisor's perspective, not the Guest OS perspective
  • Use VMXNET3 and Paravirtual adapters when possible
  • Don't be afraid of a VM running between 70% and 80% at all times, a busy VM is an efficient VM
  • Watch CO-STOP, RDY, and IO-WAIT and size accordingly
  • Most importunately, understand your workload!!!!!
unitedstatestec
Contributor
Contributor
Jump to solution

virtual CPUs (vCPUs). A physical CPU socket is the slot on the motherboard that houses the physical CPU chip. A CPU chip can have multiple cores, which are individual processing units that can handle tasks independently. Each core can handle multiple threads, which are streams of instructions that can be executed in parallel. Finally, virtual CPUs (vCPUs) are the CPUs that are presented to the virtual machine by the hypervisor, which allows the virtual machine to have its own independent processor.

To answer your question about assigning vCPUs to a VM, you would want to set the number of vCPUs to 8 if you want the guest OS to see 8 virtual processors. The number of cores per socket should be set based on the needs of the guest operating system and the application workload. In general, it's recommended to have no more than 8 vCPUs per virtual machine.

In your case, setting the VM to 2 CPU and 2 cores per socket would result in 4 virtual processors being presented to the VM. If you want to increase this to 8 vCPUs, you could set the VM to 8 vCPUs and 1 core per socket, or 4 vCPUs and 2 cores per socket.

Enabling the option to expose hardware assisted virtualization to the guest OS can improve performance for virtual machines running nested virtualization workloads or applications that require hardware virtualization support. Enabling the option to expose IOMMU to the guest OS can improve performance for virtual machines running I/O-intensive workloads that require direct access to hardware devices.

Scheduling affinity determines which physical CPUs a virtual machine's vCPUs can run on. By default, vCPUs can run on any physical CPU. Setting scheduling affinity can help ensure that a virtual machine's vCPUs run on specific physical CPUs, which can be useful for optimizing performance for specific workloads.

I hope that helps! Let me know if you have any further questions. For More Updates: UnitedStates.Tech

evanc4
Contributor
Contributor
Jump to solution

@Tibmeister 

Thank you for that information.  So I had it backwards, since I had one physical socket and 12 physical cores, I was setting the VM as 8 cpus, 8 cores per socket.  I will reconfigure it so that it is 8 cpus, 1 core per socket so that it uses 8 virtual sockets.  I already have the hot add turned off and am using paravirtual scsi and vmxnet3 so we're good there. 

@unitedstatestec 

Thanks for the clarification.  I'll use the 1 core per socket method.  It sounds like I won't need HAV or IOMMU so I will leave those off.

@RajeevVCP4 

Thanks for the links.  I will bookmark those.

Reply
0 Kudos