The SSD Relapse: Understanding and Choosing the Best SSD
by Anand Lal Shimpi on August 30, 2009 12:00 AM EST- Posted in
- Storage
The Cleaning Lady and Write Amplification
Imagine you’re running a cafeteria. This is the real world and your cafeteria has a finite number of plates, say 200 for the entire cafeteria. Your cafeteria is open for dinner and over the course of the night you may serve a total of 1000 people. The number of guests outnumbers the total number of plates 5-to-1, thankfully they don’t all eat at once.
You’ve got a dishwasher who cleans the dirty dishes as the tables are bussed and then puts them in a pile of clean dishes for the servers to use as new diners arrive.
Pretty basic, right? That’s how an SSD works.
Remember the rules: you can read from and write to pages, but you must erase entire blocks at a time. If a block is full of invalid pages (files that have been overwritten at the file system level for example), it must be erased before it can be written to.
All SSDs have a dishwasher of sorts, except instead of cleaning dishes, its job is to clean NAND blocks and prep them for use. The cleaning algorithms don’t really kick in when the drive is new, but put a few days, weeks or months of use on the drive and cleaning will become a regular part of its routine.
Remember this picture?
It (roughly) describes what happens when you go to write a page of data to a block that’s full of both valid and invalid pages.
In actuality the write happens more like this. A new block is allocated, valid data is copied to the new block (including the data you wish to write), the old block is sent for cleaning and emerges completely wiped. The old block is added to the pool of empty blocks. As the controller needs them, blocks are pulled from this pool, used, and the old blocks are recycled in here.
IBM's Zurich Research Laboratory actually made a wonderful diagram of how this works, but it's a bit more complicated than I need it to be for my example here today so I've remade the diagram and simplified it a bit:
The diagram explains what I just outlined above. A write request comes in, a new block is allocated and used then added to the list of used blocks. The blocks with the least amount of valid data (or the most invalid data) are scheduled for garbage collection, cleaned and added to the free block pool.
We can actually see this in action if we look at write latencies:
Average write latencies for writing to an SSD, even with random data, are extremely low. But take a look at the max latencies:
While average latencies are very low, the max latencies are around 350x higher. They are still low compared to a mechanical hard disk, but what's going on to make the max latency so high? All of the cleaning and reorganization I've been talking about. It rarely makes a noticeable impact on performance (hence the ultra low average latencies), but this is an example of happening.
And this is where write amplification comes in.
In the diagram above we see another angle on what happens when a write comes in. A free block is used (when available) for the incoming write. That's not the only write that happens however, eventually you have to perform some garbage collection so you don't run out of free blocks. The block with the most invalid data is selected for cleaning; its data is copied to another block, after which the previous block is erased and added to the free block pool. In the diagram above you'll see the size of our write request on the left, but on the very right you'll see how much data was actually written when you take into account garbage collection. This inequality is called write amplification.
Intel claims very low write amplification on its drives, although over the lifespan of your drive a < 1.1 factor seems highly unlikely
The write amplification factor is the amount of data the SSD controller has to write in relation to the amount of data that the host controller wants to write. A write amplification factor of 1 is perfect, it means you wanted to write 1MB and the SSD’s controller wrote 1MB. A write amplification factor greater than 1 isn't desirable, but an unfortunate fact of life. The higher your write amplification, the quicker your drive will die and the lower its performance will be. Write amplification, bad.
295 Comments
View All Comments
minime - Tuesday, September 1, 2009 - link
Thanks for that, but still, this is not quite a real business test, right?Live - Monday, August 31, 2009 - link
Great article! Again I might add.Just a quick question:
In the article it says all Indilinx drives are basically the same. But there are 2 controllers:
Indilinx IDX110M00-FC
Indilinx IDX110M00-LC
What's the difference?
yacoub - Monday, August 31, 2009 - link
If Idle Garbage Collection cannot be turned off, how can it be called "[Another] option that Indilinx provides its users"? If it's not optional, it's not an option. :(Anand Lal Shimpi - Monday, August 31, 2009 - link
Well it's sort of optional since you had to upgrade to the idle GC firmware to enable it. That firmware has since been pulled and I've informed at least one of the companies involved of the dangers associated with it. We'll see what happens...Take care,
Anand
helloAnand - Monday, August 31, 2009 - link
Anand,The best way to test compiler performance is compiling the compiler itself ;). GCC has an enormous test suite (I/O bound) to boot. Building it on windows is complicated, so you can try compiling the latest version on the mac.
Anand Lal Shimpi - Monday, August 31, 2009 - link
Hmm I've never played with the gcc test suite, got any pointers you can email me? :)Take care,
Anand
UNHchabo - Tuesday, September 1, 2009 - link
Compiling almost anything on Visual Studio also tends to be IO-bound, so you could try that as well.CMGuy - Wednesday, September 2, 2009 - link
We've got a few big java apps at work and the compile times are heavily I/O bound. Like it takes 30 minutes to build on a 15 disk SAN array (The cpu usage barely gets above 30%). Got a 160Gig G2 on order, very much looking forward to benchmarking the build on it!CMGuy - Sunday, October 11, 2009 - link
Finally got an X25-m G2 to benchmark our builds on. What was previously a 30 minute build on a 15 disk SAN array in a server has become a 6.5 minute build on my laptop.The real plus has come when running multiple builds simultaneously. Previously 2 builds running together would take around 50 minutes to complete (not great for Continuous Integration). With the intel SSD - 10 minutes and the bottleneck is now the CPU. I see more cores and hyperthreading in my future...
Ipatinga - Monday, August 31, 2009 - link
Another great article about SSD, Anand. Big as always, but this is not just a SSD review or roundup. It´s a SSD class.Here are my points about some stuff:
1 - Correct me if I´m wrong, but as far as capacity goes, this is what I know:
- Manufacturers says their drive has 80GB, because it actually has 80GB. GB comes from GIGA, wich is a decimal unit (base 10).
- Microsoft is dumb, so Windows follows it, and while the OS says your 80GB drive has 74,5GB, it should say 80GB (GIGA). When windows says 74,5, it should use Gi (Gibi), wich is a binary unit).
- To sum up, with a 80GB drive, Windows should say it has 80GB or 74,5GiB.
- A SSD from Intel has more space than it´s advertised 80GB (or 74,5GiB), and that´s to use as a spare area. That´s it. Intel is smart for using this (since the spare area is, well, big and does a good job for wear and performance over sometime).
2 - I wonder why Intel is holding back on the 320GB X25-M... just she knows... it must be something dark behind it...
Maybe, just maybe, like in a dream, Intel could be working on a 320GB X25-M that comes with a second controller (like a mirror of the one side pcb it has now). This would be awesome... like the best RAID 0 from two 160GB, in one X25-M.
3 - Indilinx seems to be doing a good job... even without TRIM support at it´s best, the garbage cleaning system is another good tool to add to a SSD. Maybe with TRIM around, the garbage cleaning will become more like a "SSD defrag".
4 - About the firmware procedure in Indilinx SSD goes, as far as I know, some manufacturers use the no-jumper scheme to make easier the user´s life, others offer the jumper scheme (like G.Skill on it´s Falcon SSD) to get better security: if the user is using the jumper and the firmware update goes bad, the user can keep flashing the firmware without any problem. Without the jumper scheme, you better get lucky if things don´t go well on the first try. Nevertheless, G.Skill could put the SSD pins closer to the edge... to put a jumper in those pins today is a pain in the @$$.
5 - I must ask you Anand, did you get any huge variations on the SSD benchmarks? Even with a dirty drive, the G.Skill Falcon (I tested) sometimes perform better than when new (or after wiper). The Benchmarks are Vantage, CrystalMark, HD Tach, HD Tune.... very weird. Also, when in new state, my Vantage scores are all around in all 8 tests... sometimes it´s 0, sometimes it´s 50, sometimes it´s 100, sometimes it´s 150 (all thousand)... very weird indeed.
6 - The SSD race today is very interesting. Good bye Seagate and WD... kings of HD... Welcome Intel, Super Talent, G.Skill, Corsair, Patriot, bla bla bla. OCZ is also going hard on SSD... and I like to see that. Very big line of SSD models for you to choose and they are doind a good job with Indilinx.
7 - Samsung? Should be on the edge of SSD, but manage to loose the race on the end user side. No firmware update system? You gotta be kidding, right? Thank good for Indilinx (and Intel, but there is not TRIM for G1... another mistake).
8 - And yes... SSD rocks (huge performance benefit on a notebook)... even though I had just one weekend with them. Forget about burst speed... SSD crushes hard drives where it matters, specially sequencial read/write and low latency.
- Let me finish here... this comment is freaking big.