Try
↑ ↓ move↵ openesc close
In this lesson · topic 7 of 7
  1. 1. Random writes are the expensive kind
  2. 2. Memtable, SSTables and compaction
  3. 3. Run leveled and tiered on the same writes
  4. 4. What each policy costs you
  5. 5. Why reads cost more here
  6. 6. When compaction cannot keep up
  7. 7. Memtables, runs and amplification

Topic 7

Memtables, runs and amplification

4 min read

Predict first

How does an LSM tree delete a key?

Predict first

Why is a read for a key that does not exist the worst case in an LSM tree?

Predict first

A workload is mostly inserts with very few reads, and disk space is plentiful. Which compaction policy fits best?

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

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms