Wednesday, October 27, 2010

Analysis: The Impact Of Shifting From 512 Byte To 4 KB Sectors

Slowly but surely, hard drives with 4 KB sectors are replacing the "legacy" 512 byte sector size. By January 2011, all drive vendors will have made this transition. Buyers of new PCs are safe, but there are still a few performance pitfalls to note.
The introduction of hard drives that work with a sector capacity of 4 KB instead of the conventional 512 bytes started about a year ago, but it happened without much ado. Using larger sector capacities introduces certain benefits for the hard drive makers, and is typically transparent for the end-user--but only as long as that user installs a modern operating system like Windows 7 or Vista with SP1 and up. Older Windows versions can suffer from performance troubles on 4 KB sector drives.
Therefore, we decided to look at a possible worst-case scenario. This article provides insight, analysis, and some recommendations regarding hard drives with 4 KB sector size. Effectively, this applies to the majority of new hard drives available starting January 2011.
From 512 Bytes to 4 KB
A sector is the smallest storage unit that can be found on a hard drive and it has, historically, been composed of 512 bytes. This made sense in times when hard drives stored megabytes or a few gigabytes because the sector size represents the minimum amount of capacity that will be consumed, even if the file being written is smaller. As a result, it made sense to work with a relatively small unit, just to avoid wasting capacity and to gain usable space.

However, the 512 byte sector size has turned into a limiting factor. We have to acknowledge that the average file size today is way more than 512 bytes, which turns the issue of wasted capacity upside down. This is because an Error Correcting Code (ECC) is calculated for each 512 byte chunk, and as you can imagine, ECC data also requires storage space. It goes without saying that one 4096 byte sector requires less ECC information than eight 512 byte chunks if the ECC algorithms remain unchanged. In the end, the total storage capacity of a hard drive increases as a result of less ECC data overhead.
Increasing Capacity Through 4 KB Sectors
Obviously, the hard drive vendors have identified this modification as a compelling way to increase storage capacities. The beauty of this tweak is that it actually makes sense from an architectural standpoint, as other key figures (like x86 memory pages and many file system clusters) also employ the 4 KB size. In addition, the sector size adjustment represents a relatively minor change, and it doesn’t require a lot of hardware modification (as it is the case with an areal density increase). Finally, the so-called Advanced Format allows for more robust ECC algorithms, which is important in light of ever-increasing capacities.
We took a pair of 2.5” SATA hard drives to compare performance between 512 byte and 4 KB sector size, and to look at what happens in a worst-case scenario, as older system environments may deliver decreased performance on 4 KB sector drives. This would apply to any 4 KB drive, not just the ones on our bench here today.

We just talked about the benefits introduced by a 4 KB sector size. But, as always, there are potential downsides. The most relevant one is caused by compatibility, as all of the 4 KB drives available today emulate 512 byte sector size in order to be downwards-compatible with older operating systems.
At this point, it is very important to realize that it is possible to fit eight logical 512 byte sectors into a physical, 4096 byte physical sector--or to misalign them, which means that a 4 KB file system block would always access two physical 4 KB sectors. You can probably imagine what this does to performance. First and foremost, random writes would be impacted, as writing always involves reading a sector, modifying it, and writing the final data. Involving two sectors automatically creates latency and longer processing time. The first page in our benchmark results section shows the I/O performance results of one of the drives with aligned and misaligned sectors.
There are a few ways to prevent performance issues, although only one way works properly and uniformly across all hard drives that are based on 4 KB (or other) sector sizes. If you go for a current operating system like Windows Vista with SP1 or Windows 7, then you’ll have nothing to worry about. These operating systems are sector size-aware and will automatically align the file system clusters accordingly. It’s a no brainer.

Windows 7 automatically selects an LBA block number that ensures aligned operation (typically starting at block 2048). In the case of Mac OS, you’ll need Tiger, Leopard, or Snow Leopard and use the GUID partitioning table scheme. The Apple Partition Manager (APM) will misalign partitions. Linux (since version 2.6.31) also supports alternative sector sizes. Using a sector-aware operating system oftentimes is the only easy solution to avoid performance issues.
A different approach is a change to the sector numbering. If you know where a misalignment happens (for example, Windows XP starting its first new partition at LBA sector 63), you could modify the internal numbering and increament by 1 to have the parition start at LBA sector 64. This approach works, but it introduces a certain risk: if the LBA numbering is adjusted by a jumper, you could destroy data by accidentally putting the jumper back to the default position. And if the numbering is controlled on the firmware side, there might be room for hacks that can theoretically also threaten your data.
Other hard drive makers, such as WD, offer workarounds through an alignment tool, which simply relocates the entire file system to match logical and physical sectors. This solution is more robust, but requires the actual utility and some patience if lots of data already on the drive needs to be relocated.

This 2.5” 640 GB drive is probably the last one in Toshiba’s portfolio to employ conventional 512 byte sectors. It spins at 5400 RPM and has 8 MB cache memory as well as a SATA 3 Gb/s interface. The drive is available at 160, 250, 320, 500, and 640 GB capacities, but we used the 640 GB flagship for this comparison with its successor.

We found that this older model has a higher interface bandwidth of 204 MB/s (as opposed to 183 MB/s on the newer 750 GB drive) with 4 KB sector size. However, effective throughput is higher on the newer drive by quite a significant amount. The latter is a result of improvements in data density, as well as the modified sector size.
In terms of I/O performance, we found that the MK6465GSX is slightly ahead of the 750 GB MK7559GSXP, but the difference is hardly relevant. The only time when the older drive is significantly faster is when it is compared to the newer 4 KB sector size drive that runs at misaligned logical 512 byte sectors. See the benchmark section for details.

This is the latest 2.5” SATA drive from Toshiba and it happens to be based on a 4 KB sector size, making it perfect for a comparison with the 640 GB predecessor. We expected throughput to increase, which it does: a 107 MB/s peak and 81 MB/s average read transfer rate are excellent results for a 2.5” hard drive and actually not far away from the performance numbers of 3.5” drives that spin at 5400 RPM. Clearly, the performance gap between the form factors is getting a bit smaller.

As already mentioned on the previous page, we found that the new drives deliver reduced I/O performance for as long as the logical 512 byte sectors are aligned to the physical 4 KB units. The differences mainly result in increased data density and the fact that 2.5” drives are designed for mobile applications in notebooks or laptops. Therefore, a certain performance penalty in favor of efficiency is usually expected.
In fact, there are a few more benchmarks where the new drive is weaker than its 640 GB predecessor with regular 512 byte sectors. PCMark Vantage is one of them. Still, the difference isn’t as noticeable as you would think, as both 5400 RPM drives weren’t designed for the performance segment.

System Hardware
CPUIntel Core i7-920 (45 nm, 2.66 GHz, 8MB Shared L3 Cache)
Motherboard (LGA 1366)Supermicro X8SAX Revision: 1.0, Chipset: Intel X58 + ICH10R, BIOS: 1.0B
RAM2 GB DDR3-1333 Corsair CM3X1024-1333C9DHX
HDDSeagate NL35 400 GB, ST3400832NS, 7200 RPM, SATA 3Gb/s, 8 MB Cache
Power SupplyOCZ EliteXstream 800 W, OCZ800EXS-EU
Performance Measurementsh2benchw 3.12
PCMark Vantage 1.0
I/O PerformanceIOMeter 2006.07.27
Fileserver-Benchmark, Webserver-Benchmark, Database-Benchmark, Workstation-Benchmark, Streaming Reads, Streaming Writes
System Software & Drivers
Operating SystemWindows Vista Ultimate SP1
Intel Chipset9.1.0.1007
AMD GraphicsRadeon 8.12
Intel Matrix Storage8.7.0.1007

Data Transfer Diagrams

The new 750 GB drive clearly outperforms the 640 GB model. However, this has probably little to do with the sector size change, which becomes more visible in other benchmarks.

Sequential, streaming operation effectively does not suffer from misaligned sectors at all.

Throughput is significantly higher on the MK7559GSXP, which is a result of progress in general. The larger 4 KB sectors might have a small impact as well, but the improvements in data density are typically more relevant.
Interface performance is not very important in everyday operation, as drives never reach these speeds to or from the physical medium. However, it shows the peak bandwitdh into and from the drive’s cache memory.

Idle power is similar on both drives; the newer drive actually requires slightly more power in idle.
The power requirement at maximum streaming reads is identical at 2.6 W.
The power requirement during video playback could be reduced by 0.1 W.
Last but not least, the power required to deliver maximum I/O operations per second using our workstation test pattern is also 0.1 W lower on the new 750 GB MK7559GSXP with its 4 KB sectors.
Efficiency Results: Performance per Watt
Performance increased quite a bit while power consumption is identically or slightly lower. As a result, the efficiency, expressed in performance per watt, is increased on the new 750 GB drive.
The same applies to the workstation efficiency results. With aligned sectors, the new 750 GB drive delivers almost the same I/O performance as the older 640 GB model. As power consumption decreased a bit again, the performance per watt result is better.

We found that the new 750 GB Toshiba MK7559GSXP is at least a match to its predecessor, the 640 GB MK6465GSX in all low-level benchmarks. It is comparable in I/O performance and access time, and it even provides much improved throughput performance. However, our PCMark Vantage application test shows decreased performance for the new drive with its 4 KB sector size in popular Windows scenarios. What’s the best choice, then?
The low-level performance numbers show that the 4 KB sector drive is performing as expected, and that the reason for the PCMark Vantage results has to be found somewhere else. We can also be sure that the sector alignment works well because Windows Vista and Windows 7 create partitions accordingly, and because we checked separately.
However, we cannot control the way data writes are actually executed and organized. In the case of PCMark Vantage, the benchmark was never tweaked to minimize the number of smallest-size write requests in favor of larger chunks of data. If you write large files to the hard drives, then the new 750 GB drive wins--despite and because of its 4 KB sectors being smaller than the write request. But as long as applications hammer smaller data write requests onto an advanced format drive in 512 byte legacy mode, we’ll see performance impacts here and there, just because each write operation consists of Read-Modify-Write, which involves a full 4 KB sector with all of its eight, legacy 512 byte chunks.
This becomes more of an issue if more random write activity is involved, and it becomes less of an issue with larger data chunks and sequential operation. In the case of PCMark Vantage, we’re seeing great game performance because it does not involve many writes. Windows Movie Maker and Media Center, however, trigger lots of write activity, and we believe the system executes many write requests that end up being smaller than 4 KB.
Be this as it may, the IDEMA hard drive makers (International Disk Drive Equipment and Materials Association) decided that all new hard drive platforms available in channel markets shall be based on the Advanced Format (4 KB) by January 2011, meaning that the question of whether or not we like this will soon be irrelevant--unless you want to be a rebel and buy an older hard drive model.
The application performance issues we've shown remain. But if you’re using a modern operating system like Windows Vista with SP1, Windows 7, Mac OS 10.4 or up, then you are usually safe. However, you will still have to look for alignment tools if partitions are created by an imaging utility instead of the operating system, or if you run multi-boot environments. In those cases, you’ll have to dig into sector alignment whether you want it or not, or you will face more substantial performance drops.
From the hardware side there is nothing that really speaks against a 4 KB sector drive. Mainstream users will not notice much of a difference, and enthusiasts are always better off putting data onto mechanics disks, and running the operating system and applications off a fast SSD.

No comments:

Post a Comment