In the VMware Infrastructure Client (no vCenter), under the Resources / Advanced CPU
section of each VM's Edit Settings dialog, there is an option to alter the Scheduling Affinity of a VM. It sets the sched.cpu.affinity
value in the VMX file.
I believe this allows me to force a VM to only be serviced by a specific physical CPU on the host, judicious use of which might in some cases allow me to license a VM for one physical CPU rather than the two that are in the host.
The description of the config field in Edit Settings is as follows:
Hyperthreading Status: Active
Available CPUs: 12 (logical CPUs)
Select logical processor affinity for this virtual machine.
Use '-' for ranges and ',' to separate values. For example, "0,2-4,7" would indicate processors 0, 2, 3, 4 and 7.
Is it fair to assume (in this and similar cases):
- numbers 0 to 11 represent each of the physical cores (or are the 'hyperthreads' numbered too)?
- if I wanted to limit the VM to run on one of the physical CPUs, I should enter either
0-5
or6-11
(or are these numbers in some different pattern)?
Otherwise, is there a reliable source (VIC screen, shell command, etc.) to look up the number-to-CPU mapping on any particular host?
(For reference, the CPUs are Intel Xeon X5675 units, which are each 6-core with hyperthreading.)
Yes and yes HT are included
Yes, you got it in one!
Your software is likely licensed per (visible) CPU socket. If you configure your destination virtual machine with the appropriate socket and core count, it doesn't really matter where ESXi decides to schedule threads on the underlying hardware. Your software should only be concerned with what's visible to the virtual machine. In this case, a 1-socket, 4-core VM should satisfy the requirement.
See: vCPU performance between 1 or 2 vCPU's
Just like taskset and CPU scheduling on Linux, you don't want to go down the path of CPU-affinities and pinning unless you have a compelling reason.
Edit:
The numbering is the same as
taskset
. For a Westmere 6-core CPU, you will see physical and Hyperthreaded cores according to this schedule: