By following a few simple practices, you can get more value out of your server hardware while still delivering good VM performance. Brien Posey offers tips for tuning your Hyper-V environment.
Server virtualization products such as Hyper-V are designed to reduce an organization's hardware costs by allowing multiple server images to be hosted on a single physical server. Based on that premise, the more virtual machines you can fit onto a host server, the lower your hardware costs. Of course, increasing a host's virtual machine density also increases the load on the server. It's critical to allocate resources to virtual machines in a way that maximizes your hardware investment, while also delivering acceptable virtual machine performance. The following tips will help you get the most from your server hardware in a Hyper-V environment.
1: Choose your guest operating system wisely
Hyper-V is capable of hosting a wide variety of operating systems (I have even run Windows NT on Hyper-V). However, some operating systems will make better use of the hardware resources than others. As a rule, you should try to run Windows Server 2008 or Windows Server 2008 R2 on the guest machines if possible. These operating systems were specifically designed to be used with Hyper-V.
If running Windows Server 2008 or Windows Server 2008 R2 isn't an option, try to use a Windows operating system that supports Integration Services if you can. Integration Services is a series of drivers that allow a guest machine to communicate with the parent partition using the Hyper-V VMBus, which greatly improves the guest machine's performance. Windows 2000, 2003, XP, Vista, and Windows 7 all support Integration Services to varying degrees. However, Integration Services is not supported by Windows NT, Windows 9X, or non-Windows operating systems.
2: Plan your disk configuration carefully
Often times in virtual server environments, the storage pool ends up being the performance bottleneck. If possible, you should arrange your virtual machines so that each virtual hard drive resides on a separate disk, LUN, or array. That way, you won't have multiple virtual machines competing for disk I/O resources.
Unfortunately, giving each VM dedicated physical storage can be cost prohibitive. If that's the case, your best bet is to arrange your virtual machines in a way that makes efficient use of the available I/O resources. For example, if you have two virtual SQL servers that produce a lot of disk I/O, you should try to avoid having them share physical storage. If the hardware configuration prevents you from assigning separate physical storage to two such VMs, you might consider moving one of them to a different host server, where it can be paired with less demanding VMs.
3: Avoid creating snapshots
Virtual machine snapshots provide you with a way of preserving a virtual machine's state. It's common practice to create a snapshot prior to installing a patch or making a configuration change. That way, if something goes wrong, you can revert the virtual machine to a previous state without having to restore a backup.
But as handy as snapshots are, they should be used sparingly for two reasons. First, if you make a snapshot of a database server and then you have to roll the server back to the snapshot, the database will usually become corrupted. Second, snapshots can kill a VM's performance. When you create a snapshot, you are actually creating a secondary virtual hard drive (an .AVHD drive). From that point on, all write operations occur on the new drive, but read operations are spread across both drives, which affects the virtual machine's performance. The more snapshots you keep for a virtual machine, the worse that machine's disk performance will become. Therefore, it is a good idea to use snapshots sparingly and to keep them for only as long as necessary.
4: Match VMs to NUMA nodes if possible
If you run Hyper-V on a NUMA (Non Universal Memory Architecture) platform, you should configure Hyper-V so that it uses resources only from within its preferred NUMA node. Although Hyper-V can configure a VM to use resources from multiple NUMA nodes, performance suffers considerably. Hyper-V will always perform better if you can configure virtual machines to use resources from a single NUMA node.
5: Make efficient use of NICs
Most host servers do not contain enough NICs for dedicating a separate NIC to each virtual machine. So you should allocate network resources in a way that will result in the most efficient use. If possible, dedicate a NIC to any VM that tends to produce a lot of network traffic. This includes things like Exchange servers and SQL servers. If you have other VMs that do not produce as much traffic (such as domain controllers or DHCP servers), you might share a NIC between those VMs.