Why SSDs Care About What You Write: Fragmentation & Write Combining

PC Perspective's Allyn Malventano is a smart dude, just read one of his articles to figure that out. He pieced together a big aspect of how the X25-M worked on his own, a major key to how to improve SSD performance.

You'll remember from the Anthology that SSDs get their high performance by being able to write to multiple flash die across multiple channels in parallel. This works very well for very large files since you can easily split the reads and writes across multiple die/channels.

Here we go to write a 128KB file, it's split up and written across multiple channels in our tiny mock SSD:

When we go to read the file, it's read across multiple channels and performance is once again, excellent.

Remember what we talked about before however: small file random read/write performance is actually what ends up being slowest on hard drives. It's what often happens on a PC and thus we run into a problem when performing such an IO. Here we go to write a 4KB file. The smallest size we can write is 4KB and thus it's not split up at all, it can only be written to a single channel:

As Alyn discovered, Intel and other manufacturers get around this issue by combining small writes into larger groups. Random writes rarely happen in a separated manner, they come in bursts with many at a time. A write combining controller will take a group of 4KB writes, arrange them in parallel, and then write them together at the same time.

This does wonders for improving random small file write performance, as everything completes as fast as a larger sequential write would. What it hurts is what happens when you overwrite data.

In the first example where we wrote a 128KB file, look what happens if we delete the file:

Entire blocks are invalidated. Every single LBA in these blocks will come back invalid and can quickly be cleaned.

Look at what happens in the second example. These 4KB fragments are unrelated, so when one is overwritten, the rest aren't. A few deletes and now we're left with this sort of a situation:

Ugh. These fragmented blocks are a pain to deal with. Try to write to it now and you have to do a read-modify-write. Without TRIM support, nearly every write to these blocks will require a read-modify-write and send write amplification through the roof. This is the downside of write combining.

Intel's controller does its best to recover from these situations. That's why its used random write performance is still very good. Samsung's controller isn't very good at recovering from these situations.

Now you can see why performing a sequential write over the span of the drive fixes a fragmented drive. It turns the overly fragmented case into one that's easy to deal with, hooray. You can also see why SSD degradation happens over time. You don't spend all day writing large sequential files to your disk. Instead you write a combination of random and sequential, large and small files to the disk.

The Cleaning Lady and Write Amplification A Wear Leveling Refresher: How Long Will My SSD Last?
Comments Locked

295 Comments

View All Comments

  • valnar - Wednesday, September 2, 2009 - link

    Anyone?
  • antinah - Tuesday, September 1, 2009 - link

    For another great article on the SSD technology.

    I'm considering an Intel G2 for my brand new macbook pro, and if I understand what I've read correctly, performance should not degrade too much although OSX doesn't support trim yet.

    I also doubt Apple will wait too long before they release an update with trim support for osx.

    I just recently switched to mac after a lifetime with pc/windows. Anything i shoud be aware of when I install the SSD in a mac compared to pc running windows? (other than voiding the warranty and such). I'm thinking precations regarding swap usage or such.

    Best regards from norway
    Stein
  • medi01 - Tuesday, September 1, 2009 - link

    So I absolutelly need to pay 15 times as much per gigabyte as normal HDDs, so that when I start Photoshop, Firefox and WoW, straight after windows boots, it loads whopping 24 seconds faster?

    That's what one calls "absolutelly need" indeed and you also chose amazingly common combination of apps.
  • Anand Lal Shimpi - Tuesday, September 1, 2009 - link

    You can look back at the other two major SSD pieces (X25-M Review and The SSD Anthology) for other examples of application launch performance improvements. The point is that all applications launch as fast as possible, regardless of the state of your machine. Whether you're just firing it up from start (which is a valid use scenario as many users do shut off their PCs entirely) or launching an application after your PC has been on for a while, the apps take the same amount of time to start. The same can't be said for a conventional hard drive.

    Take care,
    Anand
  • Seramics - Tuesday, September 1, 2009 - link

    its not abt the 24seconds but rather the wholly different experience of near instantaneous u get wit ssd tht cannot be replicated by hdds
  • medi01 - Tuesday, September 1, 2009 - link

    Nobody starts mentioned apps together directly after boot.

    I've played WoW for a couple of years, and never had to wait dozen of seconds for it to start.

    Most well written applications start almost instantly.

    And the whole "after fresh boot" is not quite a valid option neither, I don't recall when I last switched off my pc, "hibernate" works just fine.

    The "you get completely different experience" MIGHT be a valid point, but it was destroyed by ridiculous choice of apps to start. And I suspect that it is because NOT starting stuff all together and right after boot, didn't show gap as big.
  • kunedog - Tuesday, September 1, 2009 - link

    Anand, I think your article titled "Intel Forces OCZ's Hand: Indilinx Drives To Drop in Price" (http://www.anandtech.com/storage/showdoc.aspx?i=36...">http://www.anandtech.com/storage/showdoc.aspx?i=36... could also use a follow-up, primarily to explain why the opposite has happened (especially with the Intel drives). Is this *all* attributable to Intel's disaster of a product launch? Maybe not, but in any case it deserves more attention than a brief mention at the end of this article.
  • zero2espect - Tuesday, September 1, 2009 - link

    great work again. it's for this reason that i've been coming here for ages. great analysis, great writing and an understanding about what we're all looking for.

    one thing that you may have overlooked is the difference in user experience due to the lack of hdd "buzz". fortunate enough to find myself in posession of a couple of g2160gb jobbies, one is in my gaming rig and the other in the work notebook. using the notebook the single biggest difference is speed (it makes a 18mo old notebook seems like it performs as fast as a current generation desktop) but the next biggest and very noticible difference is the lack of "hum", "buz", "thrash" and "vibrate" as the drive goes about it's business.

    thanks anadtech and thanks intel ;-P
  • Mr Perfect - Tuesday, September 1, 2009 - link

    Anand,

    Would you happen to know if there are different revisions of the G2 drives out? Newegg is listing a 80GB Intel drive with model #SSDSA2MH080G2C1 for $499, and another 80GB Intel with model #SSDSA2MH080G2R5 for $599. They are both marked as 2.5" MLC Retail drives, and as far as I can tell they're both G2. What has a R5 got that a C1 doesn't? The updated firmware maybe?

    Thanks!

    PS, dear Newegg, WTF? 100% plus price premiums? I'm thinking I'll just wait until stock returns and buy from another site just to spite you now....
  • gfody - Tuesday, September 1, 2009 - link

    It looks like the R5 is just a different retail package - shiny box, nuts and a bracket instead of just the brown box.
    Why Newegg is charging an extra $100 for it.. just look at what they're doing with the other prices. I am losing so much respect for Newegg right now. disgusting!

Log in

Don't have an account? Sign up now