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

  • Anand Lal Shimpi - Monday, August 31, 2009 - link

    Intel insists it's not an artificial cap and I tend to believe the source that fed me that information.

    That being said, if it's not an artificial cap it's either:

    1) Designed that way and can't be changed without a new controller
    2) A bug and can be fixed with firmware
    3) A bug and can't be fixed without a new controller

    Or some combination of those items. We'll see :)

    Take care,
    Anand
  • Adul - Monday, August 31, 2009 - link

    Another fine article anand :). Keep up the good work.
  • CurseTheSky - Monday, August 31, 2009 - link

    This is absolutely the best article I've read in a very long time - not just from Anandtech - from anywhere.

    I've been collecting information and comparing benchmarks / testimonials for over a month, trying to help myself decide between Intel, Indilinx, and Samsung-based drives. While it was easy to see that one of the three trails the pack, it was difficult to decide if the Intel G2 or Indilinx drives were the best bang for the buck.

    This article made it all apparent: The Intel G2 drives have better random read / write performance, but worse sequential write performance. Regardless, both drives are perfectly acceptable for every day use, and the real world difference would be hardly noticeable. Now if only the Intel drives would come back in stock, close to MSRP.

    Thank you for taking the time to write the article.
  • deputc26 - Monday, August 31, 2009 - link

    been waiting months for this one.
  • therealnickdanger - Monday, August 31, 2009 - link

    Ditto! Thanks Anand! Now the big question... Intel G2 or Vertex Turbo? :) It's nice to have options!
  • Hank Scorpion - Monday, August 31, 2009 - link

    Anand,

    YOU ARE A LEGEND!!! go and get some good sleep, thanks for answering and allaying my fears... i appreciate all your hard work!!!!

    256GB OCZ Vertex is on the top of my list as soon as a validated Windows 7 TRIM firmware that doesnt need any work by me is organized....

    once a firmware is organised then my new machine is born.... MUHAHAHAHAHAHA
  • AbRASiON - Monday, August 31, 2009 - link

    Vertex Turbo is a complete rip off, Anand clearly held back saying it from offending the guy at OCZ.
    Now the other OCZ models however, could be a different story.
  • MikeZZZZ - Monday, August 31, 2009 - link

    I too love my Vertex. Running these things in RAID0 will blow your mind. I'm just waiting for some affordable enterprise-class drives for our servers.

    Mike
    http://solidstatedrivehome.com">http://solidstatedrivehome.com
  • JPS - Monday, August 31, 2009 - link

    I loved the first draft of the Anthology and this is a great follow-up. I have been running a Vertex in workstation and laptop for months know and continue to be amazed at the difference when I boot up a comparable system still running standard HDDs.
  • gigahertz20 - Monday, August 31, 2009 - link

    Another great article from Anand, now where can I get my Intel X-25M G2 :)

Log in

Don't have an account? Sign up now