Trim VS Garbage Collection

Trim VS Garbage Collection
December 1, 2014 Oskar

From time to time I get the question whether Trim needs to be enabled if the SSD is already using GC (Garbage Collection). Some people seem to think that this is not necessary, or can even be harmful for the drive. It seems that GC has become a selling point for SSD’s, especially considering that Mac’s do not support Trim out of the box, and manufacturers often tell their customers that Trim is useless with an SSD that already uses GC.

My idea of Trim has always been that it is a complement to GC, and enhances the garbage collection rather than inhibits it. Still, there has been a lot of debate on this, both in our forums and across the web. It seems as though a general consensus has never been established.

I recently came across an insightful post on this issue through a tip from one of our Trim Enabler users (thanks Brent!). The post was made by Kent Smith, who was working at LSI at the time, a semiconductor manufacturer that produced the Sandforce Flash Controllers. The post is a bit old, but still holds true today. Excerpts of the post follows below.

_______________________________________________________________________________________

I am the Sr. Director of Marketing and Performance Analysis for the division at LSI (soon to be owned by Avago) that makes the SandForce Flash controllers. I have presented many times at the Flash Memory Summit in Santa Clara, California, on the topic of SSD operations for many years. I also have a blog on www.blog.lsi.com covering all aspects of Solid State Drives.

[…]

For the short explanation flash memory is organized in groups of pages where data can be written. Once a page is written, it cannot be rewritten until it is erased. But a page can only be erased within a group of typically 128 pages called a block. The complexity of writing data really starts to escalate in the case of random writes replacing previously written data. Random writes put the new data in previously erased pages elsewhere, peppering a block of valid data with “patches of invalid data.” In order to write new data to these patches, the whole block – all 128 pages – must be erased. But first all surrounding pages with valid data must be read and then rewritten to blank pages. The newly erased block of blank pages is then ready to save new data.

[…]

All NAND Flash-based SSDs use GC. Some use foreground GC and some use background or idle-time GC. The difference between them is covered in my blog http://blog.lsi.com/dont-let-ssds-throw-away-your-gold/ . In simple terms background garbage collection will increase write amplification (WA) and wear out the SSD sooner. Foreground GC is harder to achieve and I believe only the SandForce controller is able to do it today

[…]

TRIM is beneficial to all SSDs regardless of what kind of garbage collection is used. I talk about how TRIM came into existence and why it is necessary in my blog http://blog.lsi.com/did-you-know-hdds-do-not-have-a-del… . The TRIM command is sent by the OS to the SSD to identify what pages of data can be ignored during garbage collection. The SSD cannot tell what files have been deleted until the OS uses the same sectors to store new files, but by that time the SSD has already wasted cycles by garbage collecting data that was invalid, but known to the SS.

[…]

TRIM will benefit all SSDs in some way. Some will benefit more than others depending upon their situation.

[…]

Garbage collection without TRIM will always be moving all invalid data during the GC process acting like the SSD is operating at full capacity. Only the TRIM command can identify the invalid data and improve performance

[…]

GC is not a replacement for TRIM regardless of foreground or background type. TRIM can only make the GC process more efficient and lower the write amplification

_______________________________________________________________________________________

You can read the full post by Kent Smith over at Tomshardware or read his blog posts about Trim: Did you know HDDs do not have a Delete command? That is why SSDs need TRIM.

Comments are disabled. Please continue the discussion in the Forum.
Showing legacy comments below.

3 Comments

  1. Jim 2 years ago

    If anyone is wanting to follow up with the links in the article, they can be found on http://archive.org. But one of the URLs in this post is cut off. Here’s the link to the archived article: https://web.archive.org/web/20131004100818/http://blog.lsi.com/did-you-know-hdds-do-not-have-a-delete-command-that-is-why-ssds-need-trim/

  2. Lars 2 years ago

    By the way, this page explains very good how SSDs work with TRIM and Garbage Collection. http://computers.tutsplus.com/tutorials/how-to-check-and-enable-trim-on-a-mac-ssd–mac-60738

  3. Bebe 2 years ago

    Trim VS Garbage Collection | Cindori is an excellent piece of creating,
    I’m showing my buddies.