go back

Volume 15, No. 11

Spooky: Granulating LSM-Tree Compactions Correctly

Authors:
Niv Dayan (Pliops)* Tamar Weiss (Pliops) Shmuel Dashevsky (Pliops) Michael Pan (Pliops) Edward Bortnikov (Pliops) Moshe Twitto (Pliops)

Abstract

Modern storage engines and key-value stores have come to rely on the log-structured merge-tree (LSM-tree) as their core data structure. LSM-tree operates by gradually sort-merging data across levels of exponentially increasing capacities in storage. A crucial design dimension of LSM-tree is its compaction granularity. Some designs perform Full Merge, whereby entire levels get compacted at once. Others perform Partial Merge, whereby smaller groups of files with overlapping key ranges are compacted independently. This paper shows that both strategies exhibit serious flaws. With Full Merge, space-amplification is exorbitant. The reason is that while compacting the LSM-tree's largest level, there must be at least twice as much storage space as data to store both the original and new files until the compaction is finished. On the other hand, Partial Merge exhibits excessive write-amplification. The reason is twofold. (1) The files getting compacted typically do not have perfectly overlapping key ranges, and so some non-overlapping data is superfluously rewritten in each compaction. (2) Files with different lifetimes become interspersed within the SSD thus necessitating high overheads for SSD garbage-collection. As the data size grows, these problems grow in magnitude. We introduce Spooky, a novel compaction granulation method to address these problems. Spooky partitions data at the largest level into equally sized files, and it partitions data at smaller levels based on the file boundaries at the largest level. This allows merging one group of perfectly overlapping files at a time to limit space-amplification and compaction overheads. At the same time, Spooky writes and deletes larger though fewer files simultaneously. As a result, files with different lifetimes intersperse to a lesser extent within the SSD and thereby cheapen garbage-collection. We show empirically that Spooky achieves >2x lower space-amplification than Full Merge and >2x lower write-amplification than Partial Merge at the same time.

PVLDB is part of the VLDB Endowment Inc.

Privacy Policy