Hyper-threading is a processor technology that effectively allows a single physical processor to behave like two...
logical processors. This can potentially increase utilization of the instruction pipeline in the processor core and boost the processor's apparent performance. Virtualized environments can also benefit from hyper-threading. It allows the hypervisor to effectively double the number of virtual processors available for provisioning to VMs -- but hyper-threading isn't a perfect process. Inefficient, poorly coded or even improperly distributed workloads may even impair system performance when hyper-threading is active.
Q. What is hyper-threading and how do hypervisors benefit from it?
Hyper-threading is Intel's proprietary technology implemented to improve the utilization of processor resources, effectively allowing the processors on a server to stay busier and get more work accomplished.
The concept of hyper-threading technology -- dubbed HTT or HT -- arises from the notion that a single traditional physical processor core can only work on one thing at a time. A workload fills the processor's instruction pipeline and that pipeline typically isn't 100% filled and busy all of the time. Part of this is due to the way an application is coded and implemented, and wasted processor cycles may also arise because modern processors are typically far faster than many applications need.
Hyper-threading adds circuitry to the processor core that provides the means for a second pipeline to share the processor's execution resources, such as the memory bus, the processor caches and the processor's execution engine. The addition of hyper-threading circuitry allows the physical core to be handled as two logical processor cores. When hyper-threading is enabled, each logical processor is able to act independently of its twin and can be interrupted, halted and operated separately from the other virtual processor sharing the same core. When one logical core is idle, the twin can steal additional execution resources from the other logical core.
The important thing to note with hyper-threading is that enabling a second logical processor on the same physical core does not double the processor's performance. This is because the processor's execution resources are shared, not doubled. HTT allows the processor to work on more tasks or instruction threads in a given time, but that additional work is still constrained by the same execution resources. This makes hyper-threading architecture very different from multiprocessor -- such as dual or quad processor -- configurations that employ multiple physical processors.
Just how much added work a virtual processor can accomplish depends on the needs of the workloads vying for the processor's attention as well as the OS's ability to manage and schedule logical processors. An OS unaware of hyper-threading will treat each logical processor the same, possibly putting demanding workloads on logical processors within the same core -- possibly resulting in poor performance for those applications -- while other cores may be underutilized. By comparison, an HT-aware OS can schedule threads on different processors and spread out the work to maximize workload performance on the system.
For example, if one application makes extensive use of the processor, filling the instruction pipeline almost constantly, having a second logical processor available on that same core offers little value -- there are precious few resources left available to share. The OS can schedule the second thread to run, but it will generally perform poorly, and usually reduce the performance of the demanding application's thread by stealing needed processor cycles. A hypervisor or OS must be able to detect HTT and provision logical processors in a manner that allows all workloads to maximize processor use. If this cannot occur, hyper-threading, not virtualization, should be disabled.
Hyper-threading is not virtualization in the sense of system-level hypervisor involvement -- HTT is strictly a form of hardware-based virtualization at the processor hardware level. So what is the benefit of virtualization and hypervisors? Hyper-threading and hypervisors are not related ideas. A hypervisor can work with non-hyper-threaded processors, and hyper-threaded processors can work on a nonvirtualized system. But the two ideas can be complementary, and modern hypervisors like VMware vSphere can detect and employ hyper-threading when pooling and provisioning virtual CPUs to VMs. This gives the hypervisor more flexibility in organizing and scheduling work, which can potentially lead to better utilization and efficiency for virtualized servers.
How can you divide a physical CPU into multiple virtual CPUs?
Tips for choosing the right CPU features for virtualization
How do CPU and memory affect application performance
Dig Deeper on Server hardware and virtualization
Related Q&A from Stephen J. Bigelow
Just because software passes functional tests doesn't mean it works. Dig into stress, load, endurance and other performance tests, and their ... Continue Reading
Don't neglect form factor as part of your data center server selection. Instead, figure out what type of environment you need and learn which server ... Continue Reading
Learn how load balancing in the cloud differs from a traditional network traffic distribution, and explore the different services available from AWS,... Continue Reading