How can you be sure whether your Hyper-V host servers and virtual machines (VMs) have been optimally configured? Installing and enabling Microsoft Hyper-V and creating VMs is a fairly straightforward process; but the techie tendencies in all of us seems to nag the question "Isn't there something more I should do to improve performance?" This tip targets system administrators who have deployed Hyper-V and want to ensure that they've made the most of host servers and VMs.
As you try to improve performance, it's tempting to just fiddle with the controls. You know the routine: Enable a checkbox here, change the memory configuration there. And when performance problem arises, there's a tendency to just throw hardware at it. But there's a better way than ad hoc response.
A key aspect of monitoring and optimizing system performance is understanding the requirements of the workloads that need support. Identity the requirements and dependencies of the software you're running, then categorize its resource utilization parameters. Some high-level considerations include the following:
- CPU requirements. Are the applications CPU-intensive? Can they benefit from multiple CPUs? (That is, are they multithreaded?)
- Memory requirements. For an entire VM, what is the required amount of memory ? Is this number expected to during certain patterns of activity?
- Network configuration. Does a VM need access to other production systems or to the Internet? Is it expected to generate a significant amount of traffic?
- Storage options. What are the speed and capacity requirements for virtual storage? Can applications benefit from using network-based storage?
You can either gather this data from historical performance statistics, or you may have to make an educated guess. Either method should help you identify the potential cause of performance issues.
Use supported operating systems
One of the primary benefits of a hypervisor is its ability to support a large number of potential guest OSes. But just because you can run OS/2 or Windows 3.1 on your production servers doesn't mean that you should. Most virtualization platforms play favorites with guest OSes. For example, Hyper-V includes its integration services with optimized drivers for Windows platforms and also fully supports various distributions of Linux.
So, when possible, deploy workloads onto guest OSes that appear on the approved list for that platform. For optimal performance, Microsoft recommends using Windows Server 2008 as a preferred guest OS. This allows you to use synthetic drivers and to take advantage of up to four virtual CPUs within each VM. That's not to say that hundreds of other operating systems won't run well (they do), but if squeezing the best performance out of your systems is the goal, use vendor-suggested OSes.
For most system administrators, using tools like Task Manager and Performance Monitor is as natural as looking through the windshield while driving. While these tasks are straightforward, the statistics that are collected from within the child and parent partition can be misleading. Remember that one of the primary goals of virtualization is to provide complete isolation between partitions. This means that standard monitoring tools often don't provide you with the full picture. Ben Armstrong's blog entry, "Hyper-V, Virtual Machine CPU usage and Task Manager", provides more details. So what should you monitor?
Hyper-V includes a long list of Hyper-V-related performance counters. You can access them from a local or remote computer running Performance Monitor. Some of the specific objects of interest are the following:
- Hyper-V Hypervisor
- Hyper-V Hypervisor Logical Processor
- Hyper-V Hypervisor Partition
- Hyper-V Hypervisor Virtual Processor
- Hyper-V Virtual IDE Controller
- Hyper-V Virtual Machine Bus
- Hyper-V Virtual Machine Summary
- Hyper-V Virtual Network Adapter
While I won't detail each of the objects in depth, note that you can use the Hyper-V Hypervisor Logical Processor performance counters to get information about CPU usage on the system. This will help identify any potential bottlenecks.
Allocating CPU resources
Not all VMs are created equal, and you will likely want to give priority to one or more of the guests that run on your server. Hyper-V allows you to manage CPU resource allocation per VM using two methods. Weights are relative values that Hyper-V uses to dole out CPU resources when cycles are in short supply (that is, they kick in only when the server is loaded to near capacity.) As long as you use a consistent system for assigning weights, this method is the easiest one to configure and helps ensure that you don't accidentally leave CPU resources under- or overutilized.
Reserves are "hard limits." A minimum CPU limit ensures that VMs always get at least some CPU cycles, regardless of how busy the host server is. The maximum value prevents one or several VMs from monopolizing system resources. You can use both relative weights and constraints, but it's important to ensure that the settings are configured based on the needs of each workload. Best of all, you can change these settings on the fly (that is, while a VM runs). That ability helps you troubleshoot where VMs waste resources or, alternatively, are starving for them.
These tips for monitoring and optimizing performance on Hyper-V servers are just the beginning. Stay tuned for the second tip, which focuses on additional methods of improving CPU, memory, disk, network and overall guest OS performance.
About the author: Anil Desai is a Microsoft MVP and a Microsoft Certified Professional with numerous credentials, including MCITP, MCSE, MCSD and MCDBA. He is the author or co-author of nearly 20 technical books, including several study guides for Microsoft certifications.