Aligned I/O and large sector disks – VHD, VHDX, and VS 2012 install

The issues of aligned disk I/O have been understood for a while. One example is where the Microsoft VHD file format ensured that ¾ of data blocks within a VHD file would be aligned on a 512 byte boundary, and not a 4096 sector boundary. See the Technet blog I authored a few years ago “Some observations on Dynamic VHD Performance”.

That makes using VHD files with large sector drives (which read and write data in 4k units) extremely painful. See the MSDN KB article “Using Hyper-V with large sector drives on Windows Server 2008 and Windows Server 2008 R2”. The KB article mentions a performance degradation of up to 30%.

The problem here is that Hyper-V performs non-cached I/Os which result in a Read, Modify, Write cycle as the KB article describes. For example, if 4kb of data needs to be written, and if that data spans 2 adjacent physical 4kb sectors, Windows needs to read 8kb, modify 4kb of this 8kb data, and then write back 8kb of data.

Recognizing the problem, the Hyper-V team introduced the VHDX file format in Windows Server 2012. Look at a fellow MVP blog “Why Windows Server Hyper-V VHDX 4k alignment is so important

And now, let us return to my earlier blog about Visual Studio (VS) 2012 installer performing non-aligned writes. Since these are cached writes, the performance degradation on large sector disks will not be as noticeable. But just because one issues cached writes does not mean the data stays in cache until you are done writing to the file and close the file, when the cache is flushed. Since Visual Studio writes in a pattern where the first and last writes to a file are odd length bytes, and all intermediate writes are even bytes, the data in the cache, while the file is being written to, is always odd bytes in length. So should the cache get flushed, for any reason, you now have the equivalent of misaligned I/Os, and the penalty on large sector disks is even more noticeable.

I will be looking to buy a large sector disk and try installing VS 2012 to that disk. In the meanwhile, I would love to hear from any reader that has already tried this experiment.

Post a comment or leave a trackback: Trackback URL.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: