Dynamic VHDs – Yes, you can use them in production (most of the time)!

For those following along, yes we missed a couple days there in our 12 days of Hyper-V FAQs, Tips, and Tricks. In my defense, I was building out a new scale-out production Hyper-V Cluster on Win8, and it was all so exciting, I lost all track of time for a day or two. 🙂

More on Windows 8 soon.

But back to the focus – Tips and Tricks.

The Dynamic VHD topic is one that’s near and dear to my heart, and also another one that’s a bit controversial. Depending on who you ask, the answers can be “it’s fine – use Dynamic VHDs and don’t think twice” to “don’t use them at all in production“. I lean toward the former statement (with some caveats), and I’ll do my best to explain why.

First, I want to state that I strongly disagree with the statement “You should use fixed disks in production, but dynamic disks are OK for test and dev”. This blanket statement, though great as a type of CYA for someone who either doesn’t know the details of a deployment or doesn’t have time to go into them”, is far from the case in many (if not most) of the cases I’ve come across.

I also want to start out by saying that a fixed VHD will always outperform a dynamic VHD (sometimes by 10%, sometimes more), just like a Corvette will always outperform a Ford Fiesta. However, I drive a Ford Fiesta, because it’s a heck of a lot cheaper, and it provides me 100% of what I need to get there, and when I drive to work with mostly 40 mph speed limits along the way, I’m never the least bit aware of any limitations in performance. I can take the difference in money saved, and apply to it to whatever else I want.

Likewise with Dynamic VHD, when you look at the cost of storage, and balance that against performance requirements for your application, more often than not, I think you’ll find that the money you can save by going with Dynamic VHD can significantly outweigh the benefits of using Fixed VHD for the workload.

In my role with Indiana University’s Auxiliary Information Technology Infrastructure team, I support about 300 virtual machines running a variety of workloads, from File, Print, and IIS to SQL, Oracle, SharePoint, and System Center. We run all of these workloads in Dynamic VHD, all on Cluster Shared Volumes, and our performance is acceptable. Could it be 10% (or more) faster? Yes. Would that potentially cost us tens or hundreds of thousands of dollars more in storage (or force us to constantly re-evaluate disk size and try to grow the disk via scripts)? Yes. From a cost/benefit analysis, we chose Dynamic VHD.

From a tips and trick perspective though, make sure you monitor the disk space where the VHDs live! The number one issue people will hit Dynamic VHD (as well as when using snapshots), is that they fail to watch the disk or LUN from the parent, and after humming along for a year, find themselves out of disk space with a bunch of crashed VMs. Make sure you stay ahead of your space requirements on the Hyper-V side. We personally have a Thin Provisioned SAN (Dell Compellent), and I set all our LUNs to be 2TB, so we never run into issues from that perspective, but if you aren’t thin provisioning your LUN, take extra care there to monitor your space.

I’ll close with my CYA caveat as well – For some scenarios, as Aidan described in his post, you can hit perf issues. It depends a lot on what kind of storage you have underneath what you’re deploying to. I can safely say that we’ve not seen the fragmentation issue that Aidan describes, and I don’t actually think that VHDs would grow like that on the disk to begin with for a few reasons: one is that Windows doesn’t just write chunks of data to the disk starting at the beginning and working to the end, for reasons like the one he mentions. Another is that if you’re using a big virtual SAN array anyway, those blocks are spread across tens of disks anyway.

So, as I’ve said before, I’ll say it again. Test dynamic VHD in your environment. If it performs well, go for it. There are lots of guidance docs recommending against it depending on the scenario, but most of those are for CYA reasons. Choose wisely, but don’t be afraid to try these out and use them in production. I do, and am happy we made the leap.

Good Luck, and Happy Virtualizing!

Janssen

One thought on “Dynamic VHDs – Yes, you can use them in production (most of the time)!”

  1. "I don't actually think that VHDs would grow like that on the disk to begin with for a few reasons: one is that Windows doesn't just write chunks of data to the disk starting at the beginning and working to the end, for reasons like the one he mentions."

    yes windows does that. if you tell windows to allocate 100GB of data, it will try to find an empty space to store the 100gb file in one chunk, if that file grows, windows will of course try to keep the file consolidated and write immediately after that 100gb chunk. if that is not possible, it finds the next possible chunk of free space where the new data fits and now the file is fragmented. The point is: Windows will try, windows is smart, not dumb. But if you have multiple dynamic VHDs running at the same time, and they grow randomly and sporadically, then the dynamic VHDs need write new chunks randomly and sporadically, then the dynamic VHDs gets fragmented.

Leave a Reply

Your email address will not be published. Required fields are marked *