What is CPU Affinity
You can restrict the assignment of virtual machines to a subset of available processors in mutliprocessor systems by assigning CPU affinity setting for each virtual machine. The CPU affinity setting for a virtual machine applies to all of the virtual CPUs associated with the virtual machine and to all other threads (also known as worlds) associated with the virtual machine. Such virtual machine threads perform processing required for emulating mouse, keyboard, screen, CD-ROM, and miscellaneous legacy devices. For example, if we have a server with 2 physical processors and 6 cores each, total available are 12 cores . We can select how many cores and which cores need to be used by a particular VM. CPU Affinity means, it will not dedicate the CPU cores for this VM, it will still allow other VM use the CPU which was been selected in the CPU affinity rules. We will talk in detail about VMware CPU affinity in this article.
What is Hyperthreading?
As per Wikipedia definition,”Intel’s proprietary HT Technology is used to improve parallelization of computations (doing multiple tasks at once) performed on PC microprocessors. For each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible. The main function of hyper-threading is to decrease the number of dependent instructions on the pipeline.”Hyperthreading technology allows a single physical processor to behave like two logical processors.Although hyperthreading does not double the performance of a system, it can increase performance by better utilizing idle resources.
The HT core sharing option enable us to define the different types of physical core sharing techniques with the virtual Machines.
There are 3 different HT Sharing methods
1. Any
2. None
3.Internal
Let’s take a look on each one of HT sharing methods.
Any
With this Setting, CPU cores of the ESXi server is allowed to freely share with virtual CPUs of the virtual machine and also with the virtual CPU’s of any other virtual Machine.
None
With this Setting, CPU cores of the ESXi server is not allowed to share within the virtual CPU’s of the virtual machine and also not allowed to share with the virtual CPU of any other virtual machine. Each virtual CPU from this virtual machine should always get a dedicated core for it is own.
Internal
With this Setting, CPU cores of the ESXi server is allowed to share within the virtual CPU’s of the virtual machine but not allowed to share with the virtual CPU’s of other virtual Machine. This option is similar to None. Only virtual machine configured with virtual SMP can utilize this setting.
From the above screenshot, We can see one more option called ” Scheduling Affinity” under the Advanced CPU settings.What is that?
Scheduling affinity is not but the CPU Affinity, you can assign a virtual machine to a specific processor and it gives us the detailed control over how virtual machine CPUs are distributed across the host’s physical cores.
NOTE, This option will not appear under the virtual machines settings If it is in a DRS cluster or when the host has only single processor core and Hyperthreading is not enabled or not available. Refer the below screenshot, My virtual machine is part of DRS cluster. So option is not appearing.
How to Configure the Scheduling Affinity:
Enter a comma-separated list of processor ranges. For example, “0,5-7” would indicate CPU affinity with CPUs 0,5,6, and 7. Selecting all processors is identical to selecting no affinity. So that virtual machine CPUs will utilize that particular cores.
I hope this article about CPU affinity will be informative for you. Thanks for Reading!!! Be social and share it in social media if you feel wort sharing it.