TRIM and SSD Performance
Over the past year, our understanding of SSD technology has advanced at a dramatic pace. In theory, SSDs are a massive and total improvement over hard disks. No longer would the system have to wait for a motor-powered platter to rotate into the right position each time it wanted a piece of data: it could just grab it in an instant from a bank of memory cells. Gone would be the noise, clatter and judder of a hard disk hiccupping as it gasped for data: in its place, smooth, silent instant data transfer.
In theory. If you've read our previous article, Why You Need TRIM for your SSD
, you'll know that the way in which SSDs handle deleted data can cause big problems: specifically, a dramatic tail off in performance.
Apple has yet to publically state if and when OS X will support TRIM
Here's how we explained it in the previous piece: SSDs are split into cells. Imagine a brand new SSD, with a clean 20KB cell. The drive writes two 10KB files to this space, dropping them in at its full write speed. If you then deletes one of the 10KB files, the SSD will simply mark the unwanted 10KB file as area available to be rewritten. This is exactly like a hard drive, and just as with a hard drive, it will crucially not delete the now junk physical data.
However, unlike a hard drive which can just write straight over that 10KB of space when a new file comes along, when the SSD comes to rewrite data to its 10KB of “free” space in the now dirty cell, in order to retain the 10KB file still there, it must first read that data to its cache or controller, wipe the whole 20KB cell clean and then rewrite the complete set of valid data, old and new, into the cell. While rewriting data has little impact on performance for a hard disk drive, this read-modify-write process can drastically reduce performance on an SSD in comparison to writing to virgin cells, and is one of the main causes of SSD performance degradation following extended heavy use.
SSDs can suffer from dramatic performance degradation, owing to the way their controllers work
Ironically for a device which can theoretically address any given cell at the same speed, SSDs can also become subject to fragmentation as a knock-on effect to dirtied NAND. Having numerous cells filled with junk data means the drive will need to perform more read-modify-write cycles when writing files, causing further performance degradation. A heavily fragmented drive will also be forced to spread files over many more cells, forcing the drive to address all those cells when then reading the data, so subsequently reducing total read speeds too.
This lead to marked performance degradation. We tested a series of SSDs in both their brand new state, and then after heavy use. We simulated this by copying 100GB of mixed files (OS files, multiple game installs, MP3s and larger video files ) to the SSD, deleting them, and then repeating the process ten times, writing a total of 1TB of data to these SSDs.
We then compared performance, and the results were startling
. Results varied drive-to-drive, with write speeds falling by up to 72 per cent. Random write speeds were particularly badly affected - the speed of writing 4KB files dropped to just 23MB/s in comparison to the 66MB/s of a new drive with the Corsair P128, for instance.
There is a fix though, in the shape of the TRIM command. This command reorganises written data and scrubs junk data after it’s deleted (triggered by a delete command, clearing the recycle bin or formatting the drive), meaning when the drive comes to write data to that cell again, there’s nothing but nice clean NAND waiting for it. It ensures the optimum write performance, but it requires both software support from the OS and firmware support from the SSD itself. Windows 7 shipped with TRIM support built in, and as we saw from our testing, once added to the drives themselves it made a huge difference - in the 4KB random write test, with TRIM firmware, the P128's 4KB write speed rose to 51.7MB/sec.
All of this testing however, was performed on PCs using Windows 7, as when it comes to Microsoft operating systems, only Windows 7 supports TRIM. Once we'd completed the Windows article, we started to wonder about how Mac OS X dealt with SSDs.