When selecting a CPU for virtual Infrastructure it is important to know the features required in physical processor for better performance, Hyper-Threading is one of those feature which in some cases can boost up the performance by using CPU resources more efficiently and by allowing two different tasks to schedule execution resources on the same underlying physical core.
In the traditional processor (or without Hyper-Threading enabled) when a compute task (thread) is in execution cycle some CPU resources may still be unused, But in case of Hyper-Threading (HT) enabled CPU, An extra set of registers make available of those resources to the second thread and the processor acts like it has two logical cores, yet has only one.
For example, suppose your system has one physical CPU installed with two cores (Dual core processor), typically your operating system will see the two logical processors (1 core = 1 processor), But if you enable the Hyper-Threading (HT) feature in BIOS, your processor will pretend like it has 4 cores and the operating system will treat like there are 4 logical processor assigned to that.
Hyper-Threading Technology is the proprietary term used by Intel but the general term is Simultaneous Multithreading (SMT). It allows the processor to schedule two separate execution contexts per core of a physical CPU and also very quick switch between both the execution context. During execution of one compute task (thread) other thread goes into wait state that means when both the logical processors need to execute the compute task at the same time then one logical processor execute the task and another processor’s thread has to go into ‘wait’ state and vice versa. That is why it does not perform as good as two physical core processor.
In VMware vSphere you can see if the HT is enabled or not in the host’s BIOS. In the above example when the HT is disabled it will show only 2 logical processor but in case of HT enabled it will show 4 logical CPUs and you can create 4 virtual machines by assigning 1 vCPU to each. However you can also create 3 VMs by assigning 1-1 vCPU to two VMs and rest 2 vCPU to 1 (as shown in below figure) or 2 VMs by assigning 2 vCPU to 2 VM or 1 VM by giving all 4 vCPU.
When number of logical processors assigned to VMs are more than physical core is called over-commitment.
But in first scenario if all 4 VMs try to execute their tasks at the same time they will require 4 physical cores for execution but in actual they are having only 2 physical cores, In that case execution resource would be available only for two parallel tasks of two VMs (out of four) and rest of two tasks of two VMs would have to be in wait state. That is why sometimes it seems like processor is performing slightly down.
If you look at CPU performance in vSphere (in above scenario), you would see that each logical CPU (vCPU) is 50% utilized and physical core would be at 100%.
The below counters for the HostSystem object in vSphere provide this information:
cpu.utilization – Provides statistics for physical CPUs.
cpu.usage – Provides statistics for logical CPUs. This is based on CPU Hyper-Threading
In all cases performance is very much dependent on application architecture as it may result in rise as well as fall in performance using Hyper-Threading Technology, So discuss with your application architect before using this technology.