Konstantin Emelyanov - Fotolia
Choosing a CPU for virtualization and properly configuring it are just as important as choosing memory, storage and network resources; a processor that doesn't make sense for the infrastructure or one that's misconfigured could negatively affect the other three components.
VM performance also largely relies on properly configured CPU, memory, storage and network resources. Processor resources are often hyper-threaded and overprovisioned to a detrimental degree. However, before you can implement configuration best practices to avoid this, you must first select a CPU that meets your needs.
Much of the decision behind which CPU to go with -- aside from cost -- depends on the types of workloads you run. Some processors are better suited to optimizing memory management, whereas others offer better support for I/O devices.
Identify and evaluate different CPU features
Processor types, such as those offered by Intel and Advanced Micro Devices (AMD), and their specific uses are differentiated by different acronyms. For example, Intel offers VT-x, VT-d and VT-c, and AMD offers AMD-V and AMD-Vi. One of the best approaches to choosing the right CPU for virtualization lies in identifying the specific features you're looking to implement in your virtual infrastructure. One feature that Intel and AMD both provide is memory space isolation through no-execute (NX) and execute disable (XD) bits, respectively, which protects VMs from malware. NX/XD bits ensure that the CPU refuses to run code in protected areas.
Other CPU features that are key to virtualization are the Load AH from Flags (LAHF) and the Save AH to Flags (SAHF) commands and virtualization extensions. LAHF and SAHF commands enable control over register contents, while virtualization extensions provide better resource utilization. Choosing the right hardware is the first step to making sure your virtual workloads run at peak performance.
Disable hyper-threading to boost performance
The next step is to ensure you put your CPU to good use. Identify which features to take advantage of and which features might lead to performance problems down the road. Hyper-threading is a CPU feature that organizes and schedules application threads, but it isn't always the most efficient way of improving processor performance. Hyper-threading works by providing a second pipeline for instruction sets to avoid resource waste.
The problem with this approach is that the core itself only has one execution engine, so resource contention can occur, which causes performance bottlenecks. Instead of using hyper-threading, consider spending the money upfront for more cores when purchasing a CPU for virtualization, if possible. Even if you don't experience performance problems due to hyper-threading, having multiple cores equates to more overall power to prioritize and execute instruction sets.
Minimize virtualization overhead with SLAT
One common issue with virtualization is the amount of overhead it requires. The software layer brings overhead that can reduce the resources that are available to VMs. Second Level Address Translation (SLAT) -- a processor feature that Intel calls Extended Page Tables and AMD calls Rapid Virtualization Indexing or Nested Page Tables -- helps reduce that overhead, which improves virtualization performance.
SLAT eliminates repetitive work by adding a cache for recent virtual-to-physical page table mappings that the hypervisor has generated. If the mapping information already exists in the cache, those CPU and memory resources aren't needed for the translation. The level of overhead saved varies depending on the specific workload. Also, some systems require that you enable SLAT support in the BIOS to take advantage of the feature.
Remember your goals when reviewing hardware specs
When you select a server for virtualization, consider CPU, memory, storage and network I/O. All four of these elements are key to server consolidation. In terms of CPU specs, you should evaluate the number of cores, internal cache size and clock speed.
Think about what you want to achieve with your virtual infrastructure and the types of workloads you run when choosing a CPU for virtualization. If reducing your footprint is the main goal, consider going with a larger number of cores over faster clock speeds. However, if workload performance is a bigger concern, faster clock speeds and fewer cores might make more sense. More memory and storage help with server consolidation as well, but you should size memory and storage according to your needs so you don't end up with wasted resources. Finally, make sure you have enough network bandwidth to accommodate your virtual workloads.
Provision enough vCPU resources to VM workloads
Demanding workloads require a creative approach to allocating processor resources. Every application and its computing requirements are different. Most VMs will operate normally with one vCPU, but for more labor-intensive workloads, such as database or email servers, you might need as many as four vCPUs.
To start, provision the same number of virtual processors as the physical processor requirements of the application dictate, and then go from there. In other words, if the application requires two physical CPUs, assign two vCPUs to it, and monitor the performance to see if it needs more. In addition, if the workload is particularly demanding, assign vCPUs from different cores to balance the load. Applying affinity and anti-affinity rules can help you specify which CPUs VMs should and shouldn't use.