The Trim Command: Coming Soon to a Drive Near You

We run into these problems primarily because the drive doesn’t know when a file is deleted, only when one is overwritten. Thus we lose performance when we go to write a new file at the expense of maintaining lightning quick deletion speeds. The latter doesn’t really matter though, now does it?

There’s a command you may have heard of called TRIM. The command would require proper OS and drive support, but with it you could effectively let the OS tell the SSD to wipe invalid pages before they are overwritten.

The process works like this:

First, a TRIM-supporting OS (e.g. Windows 7 will support TRIM at some point) queries the hard drive for its rotational speed. If the drive responds by saying 0, the OS knows it’s a SSD and turns off features like defrag. It also enables the use of the TRIM command.

When you delete a file, the OS sends a trim command for the LBAs covered by the file to the SSD controller. The controller will then copy the block to cache, wipe the deleted pages, and write the new block with freshly cleaned pages to the drive.

Now when you go to write a file to that block you’ve got empty pages to write to and your write performance will be closer to what it should be.

In our example from earlier, here’s what would happen if our OS and drive supported TRIM:

Our user saves his 4KB text file, which gets put in a new page on a fresh drive. No differences here.

Next was a 8KB JPEG. Two pages allocated; again, no differences.

The third step was deleting the original 4KB text file. Since our drive now supports TRIM, when this deletion request comes down the drive will actually read the entire block, remove the first LBA and write the new block back to the flash:


The TRIM command forces the block to be cleaned before our final write. There's additional overhead but it happens after a delete and not during a critical write.

Our drive is now at 40% capacity, just like the OS thinks it is. When our user goes to save his 12KB JPEG, the write goes at full speed. Problem solved. Well, sorta.

While the TRIM command will alleviate the problem, it won’t eliminate it. The TRIM command can’t be invoked when you’re simply overwriting a file, for example when you save changes to a document. In those situations you’ll still have to pay the performance penalty.

Every controller manufacturer I’ve talked to intends on supporting TRIM whenever there’s an OS that takes advantage of it. The big unknown is whether or not current drives will be firmware-upgradeable to supporting TRIM as no manufacturer has a clear firmware upgrade strategy at this point.

I expect that whenever Windows 7 supports TRIM we’ll see a new generation of drives with support for the command. Whether or not existing drives will be upgraded remains to be seen, but I’d highly encourage it.

To the manufacturers making these drives: your customers buying them today at exorbitant prices deserve your utmost support. If it’s possible to enable TRIM on existing hardware, you owe it to them to offer the upgrade. Their gratitude would most likely be expressed by continuing to purchase SSDs and encouraging others to do so as well. Upset them, and you’ll simply be delaying the migration to solid state storage.

Free Space to the Rescue Restoring Your Drive to Peak Performance
Comments Locked

250 Comments

View All Comments

  • strikeback03 - Thursday, March 19, 2009 - link

    I understand your point, but I am not sure you understand the point I (and others) are trying to make. The SSD makers (should) know their market. As they seem to be marketing these SSDs to consumers, they should know that means the vast majority are on Vista or OSX, so the OS won't be optimized for SSDs. It also means the majority will be using integrated disk controllers. Therefore, in choosing a SSD controller which does not operate properly given those restrictions, they chose poorly. The testing here at Anandtech shows that regardless of how the drives might perform in ideal circumstances, they have noticeable issues when used the way most users would use them, which is really all those users care about.
  • tshen83 - Thursday, March 19, 2009 - link

    In the history of computing, it was always the case that software compensated for the new hardware, not the other way around. When new hardware comes out that obsoletes current generation of software, new software will be written to take advantage of the new hardware.
    Think of it this way: you always write newer version of drivers to drive the newest GPUs. When is the last time newer GPUs work with older drivers?

    Nobody should be designing hardware now that makes DOS run fast right? All file systems (except ZFS and soon BTRFS) are obsolete now for SSDs, so we write new file systems. I am not sure Intel X25-M's approach of virtualizing flash to the likings of NTFS and EXT3 is the correct one. It is simply a bridge to get to the next solution.

    SSD makers right now are making a serious mistake pushing SSDs down consumer's throats during an economic crisis. They should have focused on the enterprise market, targeting DB servers. But in that space, Intel X25-E sits alone without competition. (Supertalent UltraDrive LEs should be within 25% of X25-E by my estimation)
  • pmonti80 - Thursday, March 19, 2009 - link

    Now I understand what you meant in the beginning. But still I don't agree with you, the system reviewed is the one 99% of SSD buyers will use(integrated mobo controller + NTFS). So, why optimize the benchmark to show the bad drives in a good light?

    About the Vertex, I don't understand what you are complaining about. After reading this article most people got the idea that Vertex is a good drive and at half Intel's price (I know, I searched on google for comments about this article).
  • tshen83 - Thursday, March 19, 2009 - link

    Professional people only look at two SSD benchmarks: random read IOPS at 4k and random write IOPS at 4k(Maybe 8K too for native DB pages).

    The Vertex random write IOPS at 4K size is abysmal. 2.4MB/sec at 4K means it only does 600ish random write IOPs. Something was wrong, and Vista/ICH10R didn't help. The 8GB/sec write boundary Anand imposed on the random write IOPS test is fishy. So is the artificial io queue depth = 3.

    The vertex random write IOPS should be better. The random read IOPS also should be slightly better. I have seen OCZ's own benchmark placing the Vertex very close to Intel X25-M at random read/ write IOPS tests.

    I personally think that if you use NTFS, just ignore the SSDs for now until Windows 7 RTM. You can't hurt waiting for SSD price to drop some more in the next 6 months. Same thing for Linux, although I would argue that Linux is even in a worse position for SSDs right now than windows 7. EXT3/EXT4/JFS/XFS/REISERFS all suck on SSDs.
  • gss4w - Thursday, March 19, 2009 - link

    Anandtech should adopt the same comment system as Dailytech so that comments that don't make any sense can be rated down. Who would want to read a review of something using a beta OS, or worse an OS that is only used on servers? I think it would be interesting to see if Windows 7 beta offered any improvements, but that should not be the focus of the review.
  • 7Enigma - Thursday, March 19, 2009 - link

    Here's another vote for the Dailytech comments section. The ability to rate up down, but more importantly HIDE the comments below a threshold would make for much more enjoyable reading.
  • curtisfong - Wednesday, March 18, 2009 - link

    Why should Anand test with Windows 7b or *nix? What is the majority OS?

    Kudos to Anand for testing real world performance on an OS that most use, and to Intel for tuning their drives for it. I'm happy the other manufacturers are losing business..maybe they will also tune their drives for real world performance and not synthetic benchmarks.

    To the poster above: do you work for OCZ or Samsung?
  • Glenn - Wednesday, March 18, 2009 - link

    tshen83 "A very thorough review by tshen83, an hour ago
    BUT, still based on Windows Vista.
    "

    As long as these drives are marketed toward said OS, why would you not use it? Most of us wouldn't recognize Solaris if we saw it! And I believe you seriously overestimate yourself if your gonna drill anything into Anands head! You might need your own site, huh?

    Great Job Anand! Don't forget to remind these CEO's that they also need to provide any software needed to configure and optimize these drives to work properly. ie go to OCZ Forums and try to figure out how to align, optimize and keep your drive running like it's supposed to, in less than 4 hours of reading! It would be nice if these companies would do their own beta testing and not rely on early adopters to do it for them!
  • Roland00 - Wednesday, March 18, 2009 - link

    It was a joy to read all 31 pages
  • MagicPants - Wednesday, March 18, 2009 - link

    Anand it would be really helpful to have a list of SSD companies blacklisting you so I know which ones to avoid. In general it would be nice to know who doesn't provide review samples to reputable sites.

Log in

Don't have an account? Sign up now