In this lesson · topic 7 of 7
Topic 7
Memtables, runs and amplification
4 min read
Predict first
Predict first
Predict first
Take away
- An LSM tree writes to a memtable and flushes sorted, immutable files. A write never edits a file.
- Reads check the newest data first. A miss must check every file.
- Compaction merges files, drops old versions and tombstones, and rewrites data to do it.
- Leveled compaction spends writes to keep reads and space low. Tiered spends reads and space to keep writes low.
- Overwrites make stale data pile up, which is where space amplification comes from.
- If ingest outruns compaction, the store stalls writes to protect itself.
Sources
- Patrick O’Neil, Edward Cheng, Dieter Gawlick and Elizabeth O’Neil, The log-structured merge-tree (LSM-tree), Acta Informatica, 1996.
- Fay Chang, Jeffrey Dean, Sanjay Ghemawat, Wilson C. Hsieh, Deborah A. Wallach, Mike Burrows, Tushar Chandra, Andrew Fikes and Robert E. Gruber, Bigtable: A Distributed Storage System for Structured Data, ACM Transactions on Computer Systems, 2008.
- Niv Dayan and Stratos Idreos, Dostoevsky: Better Space-Time Trade-Offs for LSM-Tree Based Key-Value Stores via Adaptive Removal of Superfluous Merging, SIGMOD, 2018.
- Chen Luo and Michael J. Carey, LSM-based storage techniques: a survey, The VLDB Journal, 2020.