Just google for Windows disk alignment best practice, and you would find thousands of articles, whitepapers, and posts, all preaching the practice of aligning disk partitions on the 64K boundary. For instance, one of the EMC recommendations prescribes a disk alignment value of 64K for the host file systems when deploying SQL Server 2005. Microsoft states that, "misalignment can defeat system optimization of I/O operations designed to avoid crossing track boundaries."
But I must admit that I wasn't sure how much of it was based on solid first-hand and current data and how much of it was due to the sheer number of times it was recommended, giving it a life in itself. Perhaps, since everybody else was recommending it, it had to be true--one of those best practice folklore, urban legends, or myths. My attempt to scour the web for related empirical evidence always seemed to have come up empty handed. I'd be happy if it turns out that my failure to find empirical evidence was simply a direct result of my inadequate Google search skill. Regardless, I like to see some real data points.
That was the motivation, and here's the test design.
| Disk I/O Test Tool |
sqlio.exe (from Microsoft) |
| Performance Measure |
I/Os per second |
| Tool to Set Partition Boundary |
diskpar.exe (from Microsoft) |
| Test File Size |
80GB |
| Test Drive |
The test file was on a 100GB LUN presented from a SAN |
| I/O Block Size |
8KB |
| I/O Types |
Random Reads and Random Writes |
| I/O Queue Depths |
4 |
| Threads to Issue I/Os |
1, 2, 4, 8, 16, 20, 24, 28, 32, 36 |
| Disk Partition Offsets |
63.5KB (misaligned), 64KB (recommended alignment), 64.5KB (misaligned) |
The choice of focusing on 8K random reads/writes was partly arbitrary, and partly due to the difficulty of referencing multiple charts in a blog post at this site. More importantly, as will become evident, because the result of the 8K random reads/writes is enough for us to see the wisdom of the recommendation of aligning disk partitions on the 64K boundary, including additional test scenarios would have a rather diminished margin of return.
The following two charts summarize the test results.
The first chart is a bit difficult to decipher. For 8K random reads, aligning the partition on the 64K boundary didn't produce the best result. This remained consistent in multiple runs of the same tests. Misalignment on the 63.5K boundary, on the other hand, was the worst performer, though it is debatable whether the performance difference among the three boundary settings is really significant.
The second chart shows the results of 8K random writes. Unlike in the case of 8K random reads, the performance difference is no mistake in the second chart, especially between the 64K alignment and the 63.5K alignment (or misalignment). The former outperformed the latter by a whopping ~34%. Also note that the 64K alignment was consistently the best performer for 8K random writes.
Thus, based on these data points alone, it is advisable to align your disk partitions on the 64K boundary.