How to Grow an LSM-tree? Towards Bridging the Gap Between Theory and Practice

Dingheng Mo, Siqiang Luo, Stratos Idreos

Abstract

Log-Structured Merge-trees (LSM-trees) are the foundational data structure for modern high-performance key-value stores like RocksDB and LevelDB. As these trees ingest data, they must "grow" to accommodate increasing volume. Historically, systems have chosen between "vertical" growth (adding new levels) and "horizontal" growth (increasing the capacity of existing levels). While horizontal growth is theoretically superior, it is rarely used in practice due to significant operational overheads like write stalls and space amplification. This paper introduces Vertiorizon, a hybrid growth scheme that combines the theoretical efficiency of horizontal growth with the practical stability of vertical partial compactions. By employing a novel horizontal-tiering strategy and a self-tuning engine, Vertiorizon achieves up to 3.2x higher throughput than standard RocksDB while maintaining operational robustness.

The Growth Dilemma: Theory vs. Practice

LSM-trees manage data by buffering writes in memory and then flushing them into a hierarchy of increasingly larger levels on disk. As the dataset expands, the tree must grow. There are two primary paradigms for this expansion:

  1. Vertical Scheme: This approach keeps level capacities fixed. When the bottom level reaches its limit, a new, larger level is added beneath it. This is the industry standard (used in LevelDB and RocksDB) because it allows for "partial compactions"—merging small chunks of data at a time—which prevents system freezes.
  2. Horizontal Scheme: This approach keeps the number of levels fixed but increases their capacity over time. Based on the 1980s Bentley and Saxe theory, this scheme offers a mathematically better trade-off between read and write costs.

Despite the theoretical advantages of horizontal growth, it is a nightmare to implement in production. Traditional horizontal schemes require "full compactions," where entire massive levels must be merged at once. This leads to two critical issues: write stalls (where the system stops processing new data while moving massive files) and space amplification (requiring double the disk space to hold both the old and new versions of a level during a merge). Consequently, the industry has largely settled for the less efficient but more stable vertical approach.

The Vertiorizon Solution

To bridge this gap, the authors propose Vertiorizon, which introduces three major innovations:

1. Horizontal-Tiering

Previously, horizontal schemes were primarily designed for "leveling" (one sorted run per level). Vertiorizon introduces the first horizontal scheme for "tiering" (multiple runs per level), which is significantly more efficient for write-heavy workloads. The authors mathematically proved that a "decreasing-frequency" compaction strategy—where compaction occurs more frequently as a level fills up—is optimal for minimizing read costs in this context.

2. The Hybrid Layout

Vertiorizon splits the LSM-tree into two distinct sections to capture the benefits of both growth schemes:

  • The Top (Horizontal Part): The upper levels use the efficient horizontal scheme. Since these levels are relatively small, the cost of full compactions is negligible, allowing the system to benefit from the theoretical efficiency of horizontal growth where it is most frequent.
  • The Bottom (Vertical Part): The two largest levels at the bottom use a vertical scheme with partial compaction. By only merging small chunks of data at the bottom, Vertiorizon eliminates the massive write stalls and high space overhead that typically plague pure horizontal designs.

3. Self-Tuning Engine

Workloads in the real world are rarely static. Vertiorizon includes a cost model that automatically adjusts the system's configuration. It decides whether to use leveling or tiering and determines the optimal number of levels based on whether the current workload is read-heavy, write-heavy, or balanced.

Experimental Evaluation

The researchers integrated Vertiorizon into RocksDB and evaluated it against ten baseline configurations using the YCSB (Yahoo! Cloud Serving Benchmark). The experiments covered both Uniform and Zipfian (skewed) distributions with datasets containing up to 500 million key-value entries (approximately 500GB).

Key Results

  • Throughput: Vertiorizon achieved up to 3.2x higher throughput compared to the standard vertical scheme in RocksDB.
  • Space Efficiency: The hybrid approach reduced additional space amplification by 6x compared to a pure horizontal scheme, making it viable for space-constrained environments.
  • Pareto Optimality: In read-write trade-off tests, Vertiorizon’s performance curve consistently outperformed existing schemes, providing lower costs for both operations simultaneously.
  • Adaptability: Thanks to its self-tuning engine, Vertiorizon remained a top performer across various workloads, whereas specialized designs often failed when the workload characteristics shifted.

Conclusion and Future Work

Vertiorizon demonstrates that the gap between LSM-tree theory and practice can be bridged by intelligently combining growth strategies. By using horizontal growth where it is most efficient and vertical growth where it is most stable, the system achieves a new state-of-the-art in performance and reliability.

Future research directions include dynamically adjusting the boundary between the horizontal and vertical sections of the tree and exploring how this hybrid layout interacts with modern hardware like Zoned Namespaces (ZNS) or non-volatile memory (NVM). Additionally, while Vertiorizon handles skewed workloads well, further theoretical work is needed to perfect the balance of horizontal growth under extreme data skew.

Summary updated

BibTeX
@article{mo2025how,
  author = {Dingheng Mo and Siqiang Luo and Stratos Idreos},
  title = {{How to Grow an LSM-tree? Towards Bridging the Gap Between Theory and Practice}},
  journal = {Proc. ACM Manag. Data},
  year = {2025},
  doi = {10.1145/3725310},
}
Figure