Glossary

Compaction

Background merging of an LSM-tree's sorted files to reclaim space and keep reads fast.

1 min read·4 sections
Open the interactive version → diagrams, practice & more

Definition

Background merging of an LSM-tree's sorted files to reclaim space and keep reads fast.

How it works

LSM writes pile up as immutable sorted files (SSTables); compaction merges them, drops overwritten values and tombstones, and limits how many files a read must check (read amplification). It's essential but costly — it competes with live traffic for disk I/O, so tuning compaction is a big part of operating Cassandra/RocksDB.

Common questions

What is Compaction?

Background merging of an LSM-tree's sorted files to reclaim space and keep reads fast.

How does Compaction work?

LSM writes pile up as immutable sorted files (SSTables); compaction merges them, drops overwritten values and tombstones, and limits how many files a read must check (read amplification). It's essential but costly — it competes with live traffic for disk I/O, so tuning…

What is Compaction used for in system design?

LSM writes pile up as immutable sorted files (SSTables); compaction merges them, drops overwritten values and tombstones, and limits how many files a read must check (read amplification). It's essential but costly — it competes with live traffic for disk I/O, so tuning…

Part of Glossary on SystemLore — system design explained with 148 deep topics, interactive diagrams, and a build-it-yourself game. Browse the glossary and "X vs Y" comparisons, or build this one →