LSM Tree
Log-Structured Merge Tree: a write-optimized data structure that buffers writes in memory and periodically flushes sorted runs to disk. Used by Cassandra, RocksDB, and LevelDB.
What is LSM Tree?
Log-Structured Merge Tree: a write-optimized data structure that buffers writes in memory and periodically flushes sorted runs to disk. Used by Cassandra, RocksDB, and LevelDB.
LSM Tree is a intermediate-level concept that sits in the Database Types & Storage area of system design. Engineers reach for it whenever they need to reason about real-world trade-offs in that space — not just for textbook correctness, but because real production systems at companies like Netflix, Amazon, and Google make these decisions every day.
If you want to go deeper than this definition — with diagrams, code, and a quiz to lock it in — work through the "LSM Tree" lesson linked below. It walks through the why, the mechanism, the trade-offs, and how the giants actually use it in production.
Learn LSM Tree in depth
Full interactive lesson with diagrams, code examples, real-world references, and a quiz.
Open the LSM Tree lessonRelated lessons
Lessons that touch on LSM Tree as part of a larger topic.
LSM Trees
The write-optimized data structure behind Cassandra, RocksDB, LevelDB, and most modern NoSQL databases
intermediate · database types storage
Design a Key-Value Store
Design a distributed key-value store - LSM trees, compaction, consistent hashing, replication, tunable consistency, and failure detection
capstone · capstone
Compaction
How LSM-tree databases like Cassandra, RocksDB, and LevelDB clean up their mess, merging, sorting, and reclaiming space
foundation · database fundamentals
See also
Related glossary terms you might want to look up next.
B-Tree
A self-balancing tree data structure used by most relational databases for indexes. Keeps data sorted and allows searches, insertions, and deletions in O(log n).
Write-Ahead Log
A technique where changes are written to a log before being applied to the database. Ensures durability and crash recovery.
NoSQL
Databases that don't use traditional table-based relational models. Includes document stores, key-value, graph, and column-family databases.