Performance Best Practice #1: Disk I/O Alignment
So let's start this series of posts on performance optimization around one of the most common culprits—even in my own implementations: disk I/O alignment.
Let me say it again: this is by far one of the most common culprits of poor performance that I run into on a daily basis.
What is Disk IO Aligment and Why does it matter?
Consider the 200M dash: each runner must run the same length. But the track is not straight; it is curved. That means that the outside runner will have to run farther than the inside runner—if they start at the exact same point. So, to avoid that the starting blocks from which the runners launch are staggered or offset to compensate, so that all the runners end at the finish line having run the exact same distance.
Using our track analogy, each of the clusters or blocks has a fixed size: for example, Microsoft Exchange prefers a 64KB block size, while other applications may prefer differently. The problem enters with the disk: since it is round, like a running track, the length to write 64KB varies depending on which track is being read or written.
The problem comes in this way: these are the first sectors on the disk, so that means they have to be skipped by any data blocks being written. The method employed to do that is called the starting partition offset. The problem in earlier versions of windows is that the 63 reserved sectors didn't map well to the underlying tracks and sectors. As a result, the starting offset started in the middle of a physical sector, and created a logical block, such as an Exchange 64KB block, that spanned multiple sectors unnecessarily.
How Much Does it Affect My Performance?
But surely my partitions are aligned by default, right?
Unless performed at the time of partition creation, the default alignment offset will result in unaligned partitions on versions of Windows up to and including Windows Server 2003. These versions of Windows create disk partitions by default to boundaries based on the Cylinder/Head/Sector (CHS) addressing scheme used by previous generation disk controllers. — Microsoft TechNet 758814
Preexisting partitions attached to Windows Server 2008 maintain the original, flawed alignment under which they were created. — Microsoft TechNet 758814
So What Does Disk I/O Alignment Look Like?
I Got It: Now How can I Align My Disks?
1) Using Vendor Tools Such as NetApp's Virtual Storage Console (VSC). The VSC has an "Optimization and Migration" section in the solution plugin. Here, you an scan you VMs, and NetApp will tell you which are aligned and which need to be aligned, and of the latter, which can be aligned (migrated) online and which must be powered down and migrated offline. Very nice!