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
POST A COMMENT

235 Comments

View All Comments

  • sawyeriii - Wednesday, March 18, 2009 - link

    I just wanted to state how much I loved the combination of technical and real world information in this article.

    What is the possibility of having different page sizes built into a drive? I.e. you could have a drive with many 1k page packages on one die, 2k on another, and most others 4k. Could that theoretically help? Could the controllers work with that (or would you need to combine multiple 1k's into a 4k transfer size)?

    PS One note on page 3, the VelociRaptor and Intel in the first chart (responce time) are switched, however the text is correct.
    Reply
  • StormyParis - Wednesday, March 18, 2009 - link

    the ugly truth is that an SSD won't let you do anything that you couldn't do without it, and due to its cost and small capacity, it's not a replacement drive, it's an extra drive: not less power consumption but more, not less noise but just the same. You just gain a bit of time when booting up and lauching apps... which I do about 1/week and 1/day, respectively. Assuming your system has enough RAM (and if it doesn't, buy RAM before buying an SSD !), you won't feel much difference once the apps are launched.

    For the same cost, I'd rather buy a bigger screen.

    It's urgent to wait for prices to come down. But I'm all for lots of people buying them now and help get the price down for us wiser buyers.
    Reply
  • Rasterman - Thursday, March 19, 2009 - link

    I've already decided my next system in a few months will have one, after you go through 5 hard drive failures (over several years) lets see how much your willing to pay to not have to put up with it anymore. If you use your PC for anything useful (work) then an SSD is a no brainer even at $1000/64GB IMO if the data security is there, speed is secondary for me.

    When you already have the best screen, video card, memory, why not have the best drive? And your argument is pretty dumb, almost any upgrade won't let you do anything that you couldn't do without it, not just SSDs.
    Reply
  • Calin - Wednesday, March 18, 2009 - link

    You get lower power due to the lower power use of the SSD and the fact that the other drive is not stressed with difficult access patterns (small random reads/writes). Remember that idle power of a SSD drive is very low Reply
  • 7Enigma - Wednesday, March 18, 2009 - link

    No, his comment was accurate for most users. Due to the small capacities and high cost these will be used as boot drives primarily with maybe a single heavily used program (say the current game or program you are playing/using), the rest will be on an additional drive. So while the power consumption of the SSD would be less than the old drive, the aggregate power usage of both (even when the larger storage drive is primarily at idle) will be higher than the single HD.

    And I believe you meant to say traditional HD for idle power?
    Reply
  • strikeback03 - Wednesday, March 18, 2009 - link

    If all you were going to throw on the drive is the OS and a game, a 32GB drive should be plenty. The reason the 80GB and up range is important is so general consumers can load all their programs on it.

    But yes, in consumer usage other than a laptop, some people who were previously using one drive for both boot and storage would likely need a mechanical HDD is addition to the SSD. OTOH, those who were using a Velociraptor (or RAID array) for boot and another drive for storage will see their power consumption decrease.
    Reply
  • sawyeriii - Wednesday, March 18, 2009 - link

    Have you used a SSD? (If so which)

    I would state that it is not a luxary product, it is a premium product. The price difference you pay WILL translate to faster performance (if you choose correctly). More RAM only helps upto a point.

    Remember performance is based on a system of parts...
    CPU
    RAM
    NORTHBRIDGE
    GPU
    SOUTHBRIDGE
    I/O INTERFACE
    HDD/SDD

    Microsoft's Windows Experience Index has specific flaws, but the concept is sound... The system can only go a fast as the slowest component in the system (relative to the amount of time used by that component).
    Reply
  • Testtest - Wednesday, March 18, 2009 - link

    ... there's also Supertalent's Ultradrive ME (MLC) and LE (SLC) and Photofast's G-Monster v3

    At least the Supertalent drives are quite a bit cheaper with the same drive layout/controller than the Vertex drives and only differ in the firmware (which isn't bad either).

    It's however possible at least with the Ultradrive ME currently to provoke a kinda timeout error after they've been fully filled once and then still beeing written on. I don't own a Vertex so I can't test that there but if it was a controller issue, it should pop up there sooner or later as well (if you take a look in their suppport forum some error reports seem very similar).

    Intels have their 80% bug, Indilinx drives have their issues too it seems - let's hope that firmware can cure it!

    Great article btw!
    Reply
  • iwod - Thursday, March 19, 2009 - link

    Both SuperTalent and OCZ 30 / 32 GB drive cost exactly the same on NewEgg
    $129
    Reply
  • strikeback03 - Thursday, March 19, 2009 - link

    If you get Newegg's specials, one of the codes is for the 30GB for $103 with a $20MIR, so $83 with shipping if the rebate comes through. At the size I would want (~120) the Super Talent undercuts the OCZ slightly.

    Does anyone know if you can install the firmware of one maker to another maker's SSD? For example, assuming both the Ultradrive ME and the Vertex use the same Indilinx controller, and say Super Talent chose to release it with the firmware which optimizes for higher sequential speeds, would the user be able to choose the firmware which optimizes for less latency?
    Reply

Log in

Don't have an account? Sign up now