When it comes to managing performance, CPU and memory resources seem to get all the attention. Perhaps this is...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
because these parameters are relatively easy to monitor. But are these squeaky wheels the real source of performance limitations? In many real world deployments, storage performance is a common bottleneck that reduces scalability and decreases performance. In this tip, I'll describe ways in which you can optimize the performance of your virtual hard disks (VHDs) in Hyper-V.
Monitoring storage performance
In order to make solid, reliable decisions related to storage for your host systems and the guest OSes they support, you need reliable performance statistics. Most host OSes and hypervisors provide methods for collecting storage-related statistics. Most Guest OSes offer the same capabilities. For example, table 1 provides a list of statistics that can be captured in just about any version of Windows.
Table 1: Useful Windows storage-related performance statistics
You can monitor these statistics at two levels. First, performance data from the host OS or hypervisor provides overall usage statistics (aggregate values). This reflects the total amount of resource utilization expected and is useful for comparing against hardware capabilities. To drill-down into the specific source of the I/O operations, performance statistics should be monitored from within individual VMs or will require virtualization layer monitoring. This data can help you make better educated decisions about how to better allocate your VMs across a pool of host machines and their associated storage.
If you're managing more than a few hosts and VMs, you'll likely want to invest in some centralized performance monitoring and management tools. Numerous vendors are either adding these capabilities to their existing products or creating new ones to address the goals of performance monitoring.
Virtual Disk controller options
In order to make use of a VHD file, you must attach it to a VM. There are two methods of attaching the VHD. The default (and most compatible) option is to use a virtual IDE controller for the VM. You can configure the attachment in the settings of a VM (see Figure 1). A default VM has two IDE controllers, each of which can support two IDE devices (either hard disks or CD/DVD-ROM devices).
Figure 1: Attaching a VHD to an IDE controller.
Note that you also have the option of attaching a physical hard disk to the VM; however, the disk itself must be offline (a setting that you can manage using the Disk Management tool.) This approach can be used with volume-based network storage (iSCSI and Fibre Channel Storage-area Networks, or SANs), or for migrating a physical hard disk to a VM.
The other type of virtual hard disk attachment type is SCSI. By default, new VMs will not contain virtual SCSI adapters because they are less compatible. Many OSes, including versions of Windows, require specific installation and boot-time drivers to detect the controllers. However, virtual SCSI adapters can be added using the Add Hardware section of the VM's settings. Virtual SCSI adapters can provide increased performance within the VM due to SCSI's ability to support multiple concurrent commands on the bus at the same time. Each VM can have up to four SCSI controllers, plus you can attach up to 63 VHDs to each of them. But I can't think of a reasonable purpose for attaching nearly 250 VHDs to a single VM .
Keep in mind that virtual storage attachment options are completely independent of the storage technology used on the host server. Therefore, it doesn't matter whether you're using IDE, SATA, SCSI, SAS or even network-based storage to physically store the VHD files.
Maintaining VHD performance
To maintain optimal storage performance, some important operations should be planned, including:
Host file system defragmentation: This is more important when you're using dynamically-expanding VHDs, but it's a good practice to defragment physical VHD files. Be sure to schedule these operations to occur regularly, during periods of low server activity whenever possible.
Guest OS defragmentation: Depending on the type of workload that is running within your guest OS, significant logical file system fragmentation can noticeably decrease overall performance. You can combat the problem by running defragmentation operations within each VM. It's important to stagger the operations to avoid the serious disk contention that can occur when defragging multiple VHDs at the same time. Enterprise defragmentation tools can help alleviate the manual tedium of these operations.
Moving and copying VHDs: Even with the best planning, you might find the need to relocate VHDs or rebalance them on the storage infrastructure based on overall usage patterns. Keep in mind that VHDs can be centrally stored on specific arrays or distributed throughout the environment. The goal is to balance performance with manageability.
Putting VHDs in their place
Another method by which administrators can significantly improve performance is by spreading VHD I/O load across multiple physical hard disks. Perhaps the easiest way to do this is through the use of a redundant array of independent disks, or more commonly, RAID. Just about all production servers and storage arrays will use RAID for performance and fault-tolerance. If you want to improve performance even further, you should look at the storage activity for specific VHDs. You can reduce contention by placing these VHDs on separate arrays, physical disks or network storage devices. Optimizing physical placement of VHD files can significantly increase scalability and performance.
These are some ways you can squeeze more performance out of a common virtualization bottleneck: storage-related I/O. While it makes a great example, most of this information is not specific to Microsoft's Hyper-V. You can further improve storage performance by using a combination of direct-attached and network-based storage (a topic that I'll cover sometime in the future). Overall, proper care and optimization of virtual storage can yield some very positive performance results.
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 coauthor of nearly 20 technical books, including several study guides for Microsoft Certifications.