Every time you post a message, swipe a payment, or update a profile, a database has to write something to disk. Disk writes are slow — especially random ones that scatter data across a spinning platter or wear-level flash cells unevenly.
In 1996, Patrick O'Neil and colleagues described a structure that sidesteps the problem entirely: the Log-Structured Merge-tree (LSM-tree). Instead of finding the right spot on disk and overwriting it, every write is an append — the fastest thing a storage device can do.
The catch is that appending forever creates clutter. So a background process called compaction periodically merges the accumulated sorted files, throwing away stale versions and keeping the layout tidy enough for reads.
The result is one of the most important engineering trade-offs in modern systems: write performance is near-optimal, but reads and space must be actively managed. RocksDB, LevelDB, Apache Cassandra, ScyllaDB, and HBase all live on this foundation.
Comments
Loading comments...