Compare leveled and tiered compaction. Which suits a write-heavy ingest workload?
Sketch your own answer first, then compare it with the one below.
A strong answer
Leveled compaction keeps one sorted run per level, and each level is a fixed multiple larger than the one above. A merge pushes a level down into the next. Reads check few runs and stale data is removed quickly, and each entry is rewritten about once per level, or more.
Tiered compaction lets several runs of similar size accumulate and merges them together when there are enough. Each entry is rewritten about once per level, so writes are cheaper. Reads check more runs and space use is higher because old versions linger.
For write-heavy ingest where reads are rare or filtered, tiered fits. For read-heavy loads, or when disk space is tight, leveled fits. Say what you would measure to decide.
Sources
- Niv Dayan, Stratos Idreos (2018). Dostoevsky: Better Space-Time Trade-Offs for LSM-Tree Based Key-Value Stores via Adaptive Removal of Superfluous Merging.