The SSD Anthology: Understanding SSDs and New Drives from OCZ
by Anand Lal Shimpi on March 18, 2009 12:00 AM EST- Posted in
- Storage
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.
250 Comments
View All Comments
GlItCh017 - Wednesday, March 18, 2009 - link
I just wanted to comment that the backstory portion to this article is simply the most interesting part to an article (or almost even an article inside the main article). On top of that, it is easily the most interesting article I have ever read simply because of that section. Really really must say that I enjoyed reading it!radguy - Wednesday, March 18, 2009 - link
I have been waiting for this one for a while and it was very informative. Thank you very much for it. I did pick up one of the patriot warp drives for my netbook. I was really happy until I installed avg free. So not running an antivirus on it anymore but I have drive image backup incase it goes bad. Overall pretty happy as it was only 80 bucks if I get my mir.I think I'm going to wait until windows 7 till I upgrade my primary desktop. 2 of those vertexs in raid 0 would be sweet though.
sleepeeg3 - Wednesday, March 18, 2009 - link
They were one of the first SSDs you reviewed and they use their own controller. How does their random write performance compare to everything else out now?These reviews made me totally reassess the purchase of the two Samsungs I bought. I had no idea the random writes on the Samsung drives were so bad. Other reviews show the Samsung drives doing better or at least near the X25-M in write tests: http://www.techreport.com/articles.x/15433/6">http://www.techreport.com/articles.x/15433/6 However, those tests probably would have been somewhat sequential.
nubie - Wednesday, March 18, 2009 - link
Grammatically awkward sentence on Page 21:"so if you own one of these drives - you owned a fixed version."
The tense is incorrect (own/owned). I think "own a fixed version" is still awkward, perhaps "you have the fixed version", also the "so" may be superfluous. You can replace the ", so if" with a "; if". Here is how I might re-write the sentence:
"The old firmware never shipped thanks to OCZ's quick acting; if you own one of these drives - you have a fixed version."
(I am not an expert, so feel free to correct me if I am wrong.)
Awesome article btw, thanks for setting me straight on SSD, I have been steering clear of them. I hope soon you can review SSD's and most are good to excellent. :)
Flyboy27 - Wednesday, March 18, 2009 - link
This article has answered every question I've had regarding SSDs recently. Thanks Anand!Flyboy27 - Wednesday, March 18, 2009 - link
If a 120gb Vertex was around $250 I would get one yesterday. I suppose I can wait though.7Enigma - Thursday, March 19, 2009 - link
For me, 2 60's or 2 80's for around that price and I'm sold. Want the Raid0.kgwagner - Wednesday, March 18, 2009 - link
I almost didn't read this article, as everybody and their brother seems to want to explain SSDs these days and most of the articles aren't much more than glorified press releases. But, this one truly took the drives to task and presented some valid information and explanations about the state of the art and where it needs to go. Kudos, Anand. Awesome show. Good job.Mr Perfect - Wednesday, March 18, 2009 - link
"Needless to say, there was some definite fallout from that review. I’m used to negative manufacturer response after a GPU review, but I’m always a bit surprised when it happens in any other segment."Obviously you can't make a business out of irritating manufacturers, but when there really are issues, the readers want to know about them. After all, that's why we come here!
gwolfman - Wednesday, March 18, 2009 - link
You own Anand. Keep up the good work. I've seen you cited from many sites about the work you've done, in particular with SSDs. Best article I've read in months!