Optimizing your server for virtual storage
Now that you've chosen the right format -- and installed the proper guest OS -- it's time to make sure that Hyper-V and your applications don't get bogged down by unnecessary I/O operations and that VHDs are regularly maintained. Remember, disk I/O inside a VM has more impact on overall performance than on your physical rig, which is why it's essential to keep all unnecessary I/O operations down to a bare minimum:
Tip 1: Adjust the I/O bandwidth algorithm (host machine)
When using more than one VM, Hyper-V balances I/O response times between the machines. It essentially prevents one busy VM from bogging down another (less-busy) VM. The I/O balancer's settings are located under the following registry key:
If you don't want this balancing algorithm to be active at all, you can simply disable it by creating a DWORD value called "IOBalance_Enabled" and set it to "0" -- use this only if you don't care that one VM might negatively affect another, while under heavy stress. To adjust the balancing mechanism, simply create the DWORD "IOBalance_KeepHwBusyLatencyTarget_Microseconds". This entry controls how much of the total I/O operations can be processed before throttling takes effect -- you need to define a latency value (ms); the default is "83" (ms). The lower you set this value, the better the balancing, but it comes at the price of throughput.
The last DWORD value I'd like to mention here is "IOBalance_AllowedPercentOverheadDueToFlowSwitching". It defines at what percentage of disk utilization of one VM the balancer moves on to reduce the throughput of another VM. By default, its threshold is defined at 8% overall utilization in order to treat VMs equally. Before changing any of these values, I suggest running thorough speed tests using IOMeter, which has proven to be a reliable performance test tool for virtual machine environments. Carefully evaluate performance before and after changing the value.
Tip 2: Disable typical disk thrashers (Guest OS)
If you decided to run a client Windows OS (such as Windows 7) in Hyper-V, you need to turn off some features that will cause performance to drop -- all of which are not enabled by default on Windows Server 2008 R2. First, turn off SuperFetch. What makes sense on a client (with little workload and smaller data operations), might literally destroy performance on a virtual server. Same goes for Windows Search, which has a habit of constantly indexing files and causing I/O operations that just aren't necessary in about 99% of VM scenarios. Both SuperFetch and Windows Search can be disabled using "services.msc". Also, check out Windows Task Scheduler and go through the list of scheduled tasks (there are several dozen active!) and see which are necessary or not. Hint: Again, most of them -- such as error reporting or Media Center update tasks -- don't make any sense in your virtualized environment. In all of these cases, right-click and "Disable"!
Tip 3: Chkdsk and Defrag (Guest OS)
Are Disk Defragmenter and Checkdisk really necessary inside a VM? Yes, they are! But there are some caveats: Checkdisk only helps if data and the file system inside the VM got corrupted (for example, due to a power failure). It can't recover a defective VHD header. The Virtual PC Guy Ben Armstrong gives great advice on what chkdsk can and cannot do to help fix VHDs.
Defragmenting is always a good idea on the physical hardware (which avoids bottlenecks when accessing the often huge VHDs) and also helpful inside the VM, if you're using a fixed-size and dynamic VHD. The virtual disk's file system behaves the same as it would on a physical machine -- fragmentation will occur eventually.
This article, "Hyper-V & virtual PCs: How to handle virtual disks," was originally published at ITworld. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.
Sandro Villinger is a contributor to ITworld. For more by Sandro, see: Windows won't boot? Try these tips and 15 incredibly useful (and free) Microsoft tools for IT pros.