Process · Memory & Storage
Garbage collection
The background process of consolidating still-valid pages out of partly invalid flash blocks so those blocks can be erased and reused. It is the main source of write amplification and of latency spikes under sustained writes.
- Also known as
- GC
- Type
- Process
- Domain
- Memory & Storage, Storage systems
Notes
Steady-state benchmark numbers differ from fresh-out-of-box numbers largely because garbage collection has started running.
Overview
In flash storage, garbage collection is the background process by which an SSD or other flash controller reclaims space, copying the still-valid pages out of partly used blocks so those blocks can be erased and written again. It exists because NAND flash can be written a page at a time but erased only a whole block at a time, and data cannot be overwritten in place. It is a main cause of write amplification and of performance dips under heavy, sustained writing.
How it works
When the host updates data, the controller's flash translation layer writes the new version to a fresh page and marks the old page invalid, because that page cannot be rewritten until its entire block is erased. Over time, blocks fill with a mix of valid and invalid pages. Garbage collection picks blocks with many invalid pages, copies their remaining valid pages into a free block, updates the address mapping and erases the old blocks, returning them to the free pool.
The copying is extra work the host never asked for. Write amplification is the ratio of data actually written to the NAND to data written by the host, and garbage collection is the main contributor. It depends on the workload: large sequential writes typically give low write amplification, small random writes high. Higher write amplification uses up the NAND's limited program and erase cycles faster and, when collection competes with host writes, causes latency spikes.
Controllers manage this in several ways. Over-provisioning reserves capacity that only the controller can use, giving garbage collection free blocks to work with; Samsung, for example, sets its data centre SSDs to 6.7 per cent by default. The host can help by telling the drive which data is no longer needed, through commands such as TRIM or deallocate, so those pages need not be copied. Controllers also collect during idle time and keep rarely changing data apart from frequently rewritten data.
Examples
- An SSD whose write speed drops after its free blocks are used up, as garbage collection starts competing with incoming writes.
- An operating system issuing TRIM or NVMe deallocate commands for deleted files so the drive avoids copying stale data.
- Endurance ratings measured with JEDEC enterprise workloads dominated by small random writes, which drive high write amplification.
Why it matters
Garbage collection behaviour largely sets an SSD's sustained write performance, tail latency and endurance rating, so SSD firmware and FTL engineers, controller designers and storage validation teams spend much of their effort on it. Buyers see its effects in endurance figures such as terabytes written or drive writes per day, which JEDEC test workloads help standardise.
Related terms
Part of the Memory & Storage glossary, with every term in the topic and the lifecycles, tools and standards that use them.
Where it appears on the Hub
Used on 8 pages of the Hub. In each group, the pages that mention it most come first.
Skills
Suggest an improvement
Suggest an improvement to this entry
A clearer definition, an example, a correction or a source an editor can check. Editors review every suggestion before the entry changes.
Last reviewed . Written by The Semiconductor Hub editorial team. The full glossary