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

  • CList - Tuesday, September 1, 2009 - link

    Don't be disgusted at Newegg, be disgusted at the people who are willing to pay the premium price! Newegg is simply playing a reactionary role in the course of natural free-market economics and cannot be blamed. The consumers, on the other hand, are willing participants and are choosing to pay those prices. When no one is left who is willing to pay those prices, Newegg will quickly lower them.

    Cheers,
    CList
  • gfody - Tuesday, September 1, 2009 - link

    I don't understand how consumers have any control over what Newegg is charging for the 160gb that's not even in stock yet.

    If Newegg wants to get the absolute most anyone is willing to pay for every piece of merchandise they may as well just move to an auction format.
  • DrLudvig - Tuesday, September 1, 2009 - link

    Yeah, if you look at intel's website, http://www.intel.com/cd/channel/reseller/asmo-na/e...">http://www.intel.com/cd/channel/reselle...na/eng/p..., you will se that the R5 includes "3.5" desktop drive bay adapter to 2.5" SSD adapter bracket, screws, installation guide, and warranty documentation.
    Why on earth Newegg is charging that much more for it i really don't know, here in denmark the R5 retails for about 15 bucks more than the C1.. Which really isn't that bad..
  • Mr Perfect - Tuesday, September 1, 2009 - link

    Whoa. That's it? An adapter kit? With that kind of price difference, I expected it to be the D0 stepping of SSDs or something.

    Thanks for clearing that up.
  • NA1NSXR - Monday, August 31, 2009 - link

    The reason not being that performance or longevity is not good enough, but because improvements are still coming too quickly, and prices falling fast still. Once the frequency of significant improvements and price drops slow down, I will more seriously consider an SSD. I suppose it depends on how much waiting on the I/O you do though. For me, it is not so much that a Velociraptor is intolerable.
  • bji - Tuesday, September 1, 2009 - link

    Perhaps this is what you meant, but you should really clarify. It's still not time for YOU to buy an SSD. SSDs represent an incredible performance improvement that is well worth the money for many people.
  • DragonReborn - Monday, August 31, 2009 - link

    say i wanted to go crazy (it happens)...should i get two 80gb intel g2's or the 160gb intel g2? same space...is the RAID 0 performance worth it?

    i have all my important data backed on a big 2tb drive so the two ssd's (or 1 160gb) will just hold my OS/progs/etc.

    thoughts?
  • kensiko - Monday, August 31, 2009 - link

    I would say that in real world usage, you won't notice a huge difference between RAID and not RAID, SSD are already fast enough for the rest of the system. Also, TRIM may not work for now in RAID configuration.

    Just look at Windows Start up, no difference between Gen2 SSD!
  • Gc - Monday, August 31, 2009 - link

    This is a nice article, but the numbers leave an open question.
    What is Samsung doing right? Multiprocess/multithread performance?

    The article finds Samsung drives performance is low on 2MB reads,

    (new 2MB sequential reads not given, assume same as 'used')
    used 2MB sequential reads (low rank, 79% of top)

    good on 2MB writes:

    new 2MB sequential writes (middle rank, 89% of top)
    used 2MB sequential writes (2nd place, 91% of top)

    and horrible on 4KB random files:

    (new 4KB random reads not given, assume same as 'used')
    used 4KB random read (bottom ssd ranked, only 36% of top)
    new 4KB random write (low rank, only 9% of top)
    used 4KB random write (bottom ssd ranked, only 3% of top, < HD)

    Yet somehow in the multitasking Productivity test and Gaming test, it was surprisingly competitive:

    multitasking productivity (mid-high rank, 88% of top)
    gaming (mid-high rank, 95% of top)

    The productivity test is described as "four tasks going on at once, searching through Windows contacts, searching through Windows Mail, browsing multiple webpages in IE7 and loading applications". In other words, nearly all READS (except maybe for occasionally writing to disk new items for the browser history or cache).

    The gaming test is described as "reading textures and loading level data", again nearly all READS.

    Q. Given that the Samsung controller's 2MB read performance and
    4KB read performance are both at the bottom of the pack, how
    did it come out so high in the read-mostly productivity test
    and gaming test?

    Does this indicate the Samsung controllers might be better than Indilinx for multiprocess/multithreaded loads?

    (The Futuremark pdf indicates Productivity 2 is the only test with 4 simultaneous tasks, and doesn't say whether the browser tabs load concurrently. The Gaming 2 test is multithreaded with up to 16 threads. [The Samsung controller also ranks well on the communications test, but that may be explained: Communications 1 includes encryption and decompression tasks where Samsung's good sequential write performance might shine.])

    Since many notebooks/laptops are used primarily for multitasking productivity (students, "office"-work), maybe the Samsung was a reasonable choice for notebook/laptop OEMs. Also, in these uses the cpu and drive are idle much of the time, so the Samsung best rank on idle power looks good. (But inability to upgrade firmware is bad.)

    (The article doesn't explain what the load was in the load drive test, though it says the power drops by half if the test is switched to random writes; maybe it was sequential writes for peak power consumption. It would have been helpful to see the power consumption rankings for read-mostly loads.)

    Thanks!
  • rcocchiararo - Monday, August 31, 2009 - link

    Your prices are way off, newegg is charging ludicrous ammounts right now :(

    also, the 128 agility was 269 last week, i was super exited, then it went back to 329, and its now 309.

Log in

Don't have an account? Sign up now