Databases Reference
In-Depth Information
Sector Alignment
Sector Alignment is a little-known performance optimization tip that is documented for Exchange at
http://technet.microsoft.com/en-us/library/aa998219.aspx (but not very well described). It is
equally valid for SQL Server. There are a few blog postings that try to measure the performance difference
for SQL Server, but why it can cause a problem is not detailed very well. It should be performed on any
NTFS partition that is created on a RAID array to avoid misalignment with stripe units and caching,
which can cause performance degradation. Let's look in a bit more detail about what that actually means.
First of all, some disk terminology. What you're interested in for the purpose of explaining sector align-
ment are sectors, tracks, and blocks.
A sector is the smallest unit of storage space on disk and is typically 512 bytes.
A track is the circular path of sectors that sit around a single circumference of the disk. There are
63 sectors per track, numbered 1-63 on each track.
A block is how you usually refer to sectors to make things easier for you. You start at the
beginning of the disk and increment until the end of the disk. Blocks start from 0.
Partitions always start at the first sector on a track, so for the first partition that means Track 2 Sector 1
(because the MBR is on Track 1), which equates to Block number 63 (blocks start from 0). Misalignment
occurs because the storage vendors define tracks differently. On an EMC Symmetrix, for example, a track
is considered to be 64 blocks and the cache is also based on this.
A Symmetrix DMX RAID5 array uses a stripe size of 4 tracks, which totals 256 blocks. 64 KB is the largest
single write that Windows can make, so using the default partition location means that the first 64 KB
write will be fine but the second will straddle 2 stripes causing both to be updated, which impacts
performance. Figure 6-6 illustrates an un-aligned partition.
R
Reserved
(63 blocks)
64 KB
I/O
64 KB
I/O
Symmetrix RAID-5
Stripe (256 Blocks)
Symmetrix RAID-5
Stripe (256 Blocks)
Figure 6-6
If you align the partition to 128 blocks (or 64 KB as each block is 512 bytes) then you don't cross a track
boundary and therefore issue the minimum number of I/Os. Figure 6-7 illustrates an aligned partition.
B
R
Reserved
(127 blocks)
64 KB
I/O
64 KB
I/O
Symmetrix RAID-5
Stripe (256 Blocks)
Symmetrix RAID-5
Stripe (256 Blocks)
Figure 6-7
There are two methods of aligning your partition and it's quite simple. Diskpar is a tool that's been
available for a while to enable you to align partitions but as of Windows 2003 SP1 the preferred method
Search WWH ::




Custom Search