Performance is absolutely crucial when it comes to any production environment. However, as is often the case, this is even more crucial in virtualized environments. The overall impact of performance degradation or improperly performing environments is felt across a much larger section of the production infrastructure when it affects virtualized systems.
Microsoft’s Hyper-V provides a very robust and powerful virtualization solution that runs production workloads in many enterprise data centers today. As with any virtualization solution, there are certainly performance considerations and tuning that can be done to enhance the performance of the hypervisor as well as the virtual machine workloads running within the environment.
However, there are certain areas that need to be given attention when it comes to Hyper-V Virtual Machine performance to ensure the best performance possible when running workloads.
The key areas include the hypervisor host itself, CPUs, memory, storage, and networking. Each of these core areas is critical to making sure production workloads perform as expected and each can potentially become a bottleneck to solid production performance.
In this post, we’ll look at:
- Hyper-V Hypervisor Performance Considerations
- 5 Ways to Increase Hyper-V VM Performance and how each way benefit production workload performance
Hyper-V Hypervisor Performance Considerations
It goes without saying that the Hyper-V hypervisor host will benefit from hardware that is designed to handle the often-increased workloads that are related to a hypervisor host. Configuring the Hyper-V host with more powerful hardware for handling the Hyper-V workloads will definitely benefit overall performance. When thinking about the hypervisor hardware, consider the following recommendations from Microsoft for hardware that is able to handle the overall virtualization workloads:
Make sure the processors that are configured with the Hyper-V host support Second Level Address Translation (SLAT) and Extended Page Tables (EPT), additionally Nested Page Tables (NPT)
Make sure processors have a healthy configuration of cache. This benefits not only workloads that have a large working set in memory but also production workloads that have a large number of virtual processors
Root and child memory partition configurations are important with Hyper-V. The root partition is what handles I/Os on behalf of VMs and other operations like checkpoint creation. Child partitions should be sized based on loads of the running virtual machines
Make sure storage hardware has enough storage bandwidth to service both current workloads as well as potential future workloads on the host. This includes making sure RAID controllers and disks are spec’ed out properly to handle the workload demands.
5 Ways to Increase Hyper-V VM Performance
Let’s take a look at the following 5 ways to improve Hyper-V VM performance.
- Properly Manage and Size Memory
- Don’t Undersize or Oversize Virtual CPUs – NUMA
- Give Attention to Storage
- Use Recent Operating Systems
- Load Hyper-V Integration Services
When considering how to improve performance with Microsoft’s Hyper-V, these are a few basic areas that cover most of the areas where issues are encountered. Each of the above can drastically affect the performance of Hyper-V virtual machines.
Let’s see how.
Manage and Size Memory Correctly
Hyper-V offers many great features when it comes to managing memory for virtual machines. This includes Dynamic Memory as well as Memory weight.
With Dynamic memory, the Hyper-V host monitors the memory usage of the guest OS and then dynamically adjusts the amount of memory for the virtual machine based on the settings defined in the dynamic memory settings. This allows memory to be used much more efficiently in Hyper-V and allows much higher consolidation ratios.
However, Dynamic memory may not be a feature that works well with a particular application that is being ran inside a guest virtual machine. A classic example of using dynamic memory in a situation that may lead to poor performance and also into a position of being unsupported is using dynamic memory with Microsoft Exchange Server. Be sure to know your application and use only the features in Hyper-V that are supported for best performance.
To increase Hyper-V VM performance, know your RAM requirements, use dynamic memory where it can be used, but also make sure that it is supported for a particular application. This may not be the case as it is with Microsoft Exchange Server.
Don’t Oversize or Undersize the Virtual CPUs
Hyper-V overall does a great job of managing CPU resources. Typically, it does a much better job that we could ever do as a Hyper-V administrator, tweaking CPU settings manually. However, there are definitely a few points worth noting in terms of the CPU to increase Hyper-V VM performance.
A good rule of thumb with Hyper-V virtual machines is not oversize the VM or undersize it. Many inexperienced administrators may think the more virtual CPUs that can be assigned to a VM the better. However, this can lead to the opposite effect – poor performance. This is due to something called CPU Wait time per dispatch.
With CPU Wait time per dispatch, the average queue time for a virtual machine increases when a VM is waiting for CPU to become available. On so called wide-VMs with many virtual CPUs assigned, this can be a problem. Don’t oversize VMs unnecessarily.
Windows Server 2016 supports as many as 240 virtual processors per virtual machine.
Does this mean you should configure these many virtual processors for all your virtual machines? No.
Adding unneeded virtual processors adds additional overhead to the virtual machine if it doesn’t actually need the additional processors.
A good rule of thumb is to start out with (1) virtual processor. Increase the number of processors only if the virtual machines requires more than the (1) CPU under peak load. For most modern workloads, (2) cores assigned will most likely serve most workloads without causing unnecessary issues.
Keep NUMA in mind as well with Hyper-V VMs.
NUMA spanning can be enabled or disabled. With spanning enabled, individual virtual NUMA nodes can allocate non-local memory, and Hyper-V administrators can deploy more virtual processors on a VM NUMA node than the underlying hardware actually has in the physical NUMA node. This can lead to performance issues when it comes to Hyper-V VMs. Sizing CPUs correctly on the Hyper-V VMs goes a long way in increasing Hyper-V VM performance.
Give Attention to Storage
Storage is perhaps one if not the most important aspect of performance that often gets overlooked. You can have the fastest CPU and memory installed in a physical Hyper-V host and have an extremely slow virtual machine due to storage issues. Storage subsystems need to be given due attention when it comes to Hyper-V virtual machine performance.
This includes considering the type of storage (Explained in the next section) and the size of the storage.
In the past year, flash storage prices have dropped considerably, making it a much more attractive option than ever before. However, spindles are still an attractive option due to their cheap prices and large sizes.
A key area for consideration with Hyper-V VM performance in the realm of storage is right-sizing the underlying storage on the Hyper-V host for the number of VMs and the types of VMs running in the environment. If cost is the driving factor for storage, then businesses can’t expect to run hundreds of VMs on slower storage and have good performance results.
However, it is worth noting that Storage Spaces Direct and other software-defined solutions are making cheap commodity storage a viable option for running performance intensive virtual machines and is a great choice for those who want a flexible option that can scale as needed.
If more traditional shared storage is used, splitting out virtual machines between different traditional LUNs can help to divide up the demand for IOPs and ensure that certain heavy-hitter IOPs VMs do not affect the performance of all the other virtual machines across the environment.
Types of virtual controllers
The types of virtual controllers that are used in the virtual machines, VHD formats, as well as offloading for better storage performance. Considering the virtual storage controller types, the first is IDE.
IDE – Is an older format that is emulated for older operating systems that may not be able to run the Hyper-V integration services. IDE disks should also only be used for the operating system disks due to performance limitations related to the maximum I/O size that can be issued.
SCSI (SAS Controller) – This virtual controller type can support up to 64 devices and it is recommended to attach multiple disks to a single virtual SCSI controller and scale out with controllers as these are needed to connect additional disks. SCSI is not emulated like the IDE controller, so it is preferred for any disk other than the OS disk. In fact, with Generation 2 VMs, it is the only controller that is available.
Virtual Fiber Channel – This virtual controller can be used to allow access to Fiber Channel and Fiber Channel over Ethernet.
The Virtual Disk Format
Starting in Windows Server 2012 and newer, new VHDs that are created are created with 4 KB alignment. Keep in mind that simply moving a VHD from a previous Hyper-V release does not automatically convert the VHD to the new format. However, there is a command that can accomplish this task:
Convert-VHD –Path D:\vms\servervhd\server.vhd –DestinationPath E:\vms\servervhd\server-converted.vhd
VHDX Virtual Disk Format
When possible, use the new VHDX virtual disk format for performance. It includes the following performance benefits:
- Improved alignment on large sector disks
- Larger block sizes
- 4 KB logical sector which is better for performance
- More efficient data representation, smaller file sizes, and unmapping
If you are upgrading to Windows Server 2016 from a previous Hyper-V release, it is recommended due to the performance benefits, to convert VHD disks over to the VHDX format.
Use Offloaded Data Transfer
Utilizing storage that enables Offloaded Data Transfer, Windows Server Hyper-V will check the capabilities of the storage attached to Hyper-V, if hardware-assisted storage is available, copies and other operations such as merging checkpoints will bypass the software stack and make use of the hardware-assisted capabilities.
Use Recent Operating Systems
Using the most recent versions of operating systems running in Hyper-V guest virtual machines is a simple way to achieve the best performance possible out of the virtual machines. Newer operating systems have the newest available drivers and tweaks that provide the best performance running in virtualized environments. The newest operating systems are even virtualization aware. For instance, Microsoft’s latest versions of Windows already have the Hyper-V integration tools pre-installed out of the box.
Newer operating systems can also take advantage of the newest advancements in CPU, memory, and storage technologies which allow the best possible performance running in a Hyper-V environment.
Another consideration is running the latest Microsoft Windows Server operating systems allow taking advantage of the most recent clustering technologies for running guest clusters inside of Hyper-V environments. This ultimately leads to better performance, stability, usability, and flexibility in running production workloads.
Load Hyper-V Integration Services
Running Hyper-V Integration Services is one of the most basic ways to ensure properly performing virtual machines. The Hyper-V Integration Services provide the tweaks and hooks into the Hyper-V infrastructure that allows the host to interact properly with the guest virtual machine and makes sure all the required drivers to virtualize the hardware such as SCSI, IDE, and network drivers are properly installed for proper guest operating system virtualization performance.
As mentioned, these are preinstalled with the latest versions of Microsoft operating systems, however, keeping these up-to-date can go a long way to ensuring top notch performance in the environment.
There are few other things that can be done to improve the Hyper-V performance.
Perform a Server Core Installation
The Server Core installation provides an extremely small footprint for hosting server roles such as Hyper-V. It does not contain a GUI for interacting with Windows Server but rather can be administered using Windows PowerShell and various MMC management consoles from another management workstation or server.
This provides several benefits to Hyper-V such as a much smaller OS footprint and a smaller attack surface for security as well as a smaller surface for installing Windows updates.
Power Plan Considerations
A consideration to be made for performance is that Windows Server by default uses the Balanced power plan for enabling the best mix between power conservation and performance. This is known as Demand Based Switching.
However, when using the balance power plan, the highest processor performance is only applied when the host is busy. To ensure the best performance to Hyper-V workloads at all times, the High-Performance power plan should be enabled as this allows the processor to run at full speed at all times. This effectively disables the Demand Based Switching mechanism.
Disable Paging on Guest Operating Systems
In the early days of Windows, RAM was really expensive and so Microsoft designed Windows to use storage to make up for shortages in RAM through the use of a page file. Even today, Windows may still use a page file unless you explicitly tell it not to.
On the surface, using a page file might seem like a good idea in a Hyper-V environment, because doing so may help you to get away with using a little bit less memory for each VM, thereby allowing you to increase your VM density.
However, there are two problems with allowing virtual machines to use a page file.
- The first problem is that paging is slow. Your VMs will perform much better if you simply give them the RAM that they need rather than relying on the use of a page file
- The other problem with using a page file is that doing so can have secondary consequences. If your Hyper-V server uses SSD storage for example, then the paging process can shorten the SSD’s lifespan
Similarly, if Hyper-V is configured to use replication, then the paging process can increase the number of blocks that need to be transmitted during each replication cycle, thereby making Hyper-V replication slower.
Use Multiple NICs
Even though performance problems can often be attributed to a shortage of storage IOPS, a shortage of any hardware resource could potentially result in a performance bottleneck. This is especially true for network bandwidth.
It is very common for virtual machines to collectively deplete the host’s available network bandwidth.
As a best practice, you should make sure that Hyper-V infrastructure traffic is sent across dedicated network segments rather than the segments that service your production workloads. This includes things like replication traffic, failover clustering traffic, and management traffic.
Moving Hyper-V infrastructure traffic to its own dedicated network segment not only frees up bandwidth to be used by your production workloads, it can also help to improve security because you are not placing user traffic and infrastructure traffic onto the same physical segment.
Evaluate Storage IOPS
Generally speaking, the more IOPS(input/output operations per second) that you can squeeze out of your storage, the better your Hyper-V virtual machines are going to perform. Also, make sure that your storage connectivity is not acting as a bottleneck.
A high performance array will do nothing to improve the host’s performance if the host has to communicate with the array over a slow network link.
Make sure that the connection between your Hyper-V hosts and your storage has enough throughput to keep up with the storage array.
In looking at the 5 ways to increase Hyper-V VM Performance, most are basic considerations that can go a long way to delivering the performance needed in the Hyper-V environment. The sum of the performance of a Hyper-V environment often equals the weakest link in the chain. If all areas of the Hyper-V infrastructure are working properly but one area has been neglected, performance will suffer.
As mentioned, a common mistake is to give more than enough attention to the CPU and memory configured in a host, but neglect properly right-sized or configured storage. Having the best hardware and infrastructure, but failing to use the latest operating systems and not loading Hyper-V Integration Services can potentially lead to performance issues among others. Giving due diligence to the main “poor performance culprits” mentioned can help businesses get the most out of Hyper-V environments and ensure that business critical workloads are not limited by the performance inhibiting misconfigurations and other performance gotchas.Like what you read? Rate us