VMWare ESXi CPU Virtual Sockets, Virtual Cores and Advanced Settings Explained:
Cores vs Sockets Allocation is mostly created for software licencing purposes. Sometimes software won't work with if you show the guest 2 Physical CPU's aka Sockets so you would show it 1 VSocket with 2 VCores. Companies are starting to license by core anyway so this is becoming "null". I personally think most OS's/Software were written assuming 1CPU/Many Cores so I will set 1VSocket and Many VCores.
- It all gets presented the same to the VMKernel regardless
https://kb.vmware.com/s/article/1010184
- Generally a 1.5:1 ratio is advised
Eg Best Performance Settings:
1 Quad-Core CPU w/ Hyperthreading = 8 VCpus Setting should be 1VSocket and 6VCores
https://community.spiceworks.com/topic/162026-vmware-cpu-core-allocation
Advanced Settings:
- There are two main sections in "Advanced Settings for CPU" in ESXi
(Resources >> Advanced CPU)
HyperThreaded Core Sharing:
Mode:
- Any
The default for all virtual machines on a hyperthreaded system. The virtual CPUs of a virtual machine with this setting can freely share cores with other virtual CPUs from this or any other virtual machine at any time.
- None
Virtual CPUs of a virtual machine should not share cores with each other or with virtual CPUs from other virtual machines. That is, each virtual CPU from this virtual machine should always get a whole core to itself, with the other logical CPU on that core being placed into the halted state.
- Internal
This option is similar to none. Virtual CPUs from this virtual machine cannot share cores with virtual CPUs from other virtual machines. They can share cores with the other virtual CPUs from the same virtual machine. You can select this option only for SMP virtual machines. If applied to a uniprocessor virtual machine, the system changes this option to none.
Note: Can be switched while VM is powered ON
Eg Best Performance Settings:
NONE
Scheduling Affinity:
- By setting a CPU affinity on the virtual machine you are limiting the available CPUs on which the virtual machine can run
When will CPU-affinity help?
Under a controlled environment some specific workloads can benefit from using CPU affinity. When the virtual machine workload is cache bound and has a larger cache footprint than the available cache of one CPU it can profit from aggregated caches. However, if this workload has high intra-thread communications and is running on specific CPU architectures setting CPU affinity can have the opposite effect and become detrimental to the performance of the application.
http://frankdenneman.nl/2011/01/11/beating-a-dead-horse-using-cpu-affinity/
Eg Best Performance Settings:
- Unless you KNOW your application can profit from the above statement, leave this setting alone. - Can cause major management issues
CPU Resources:
- Limit
Places a limit on the consumption of CPU time for a virtual machine. This value is expressed in MHz.
- Reservation
Specifies the guaranteed minimum allocation for a virtual machine. The reservation is expressed in MHz.
- Shares
Each virtual machine is granted a number of CPU shares. The more shares a virtual machine has, the more often it gets a time slice of a CPU when there is no CPU idle time. Shares represent a relative metric for allocating CPU capacity.
Eg Best Performance Settings:
Shares = High Reservation = Max (Click Yellow Slider) Limit = Unlimited