Labor: Adaptive Lazy Compaction for Learned Index in LSM-Tree
摘要
The log-structured merge tree (LSM-tree) is widely employed in Key-Value (KV) storage to serve data-intensive applications. In order to improve read performance, the LSM-tree has been enhanced by integrating the learned index. However, the index model invalidation resulting from frequent data writes remains unresolved. To tackle this problem, we present a novel LSM-tree named Labor, which simultaneously optimizes both read and write performance. Labor primarily involves a sheet-based lazy compaction mechanism that modifies the compaction granularity from SSTable to segments. The fine-grained compaction not only improves the efficiency of the learned index but also reduces the write amplification. Furthermore, we introduce an adaptive compaction algorithm to achieve a balanced performance for varying read-write patterns. Experimental results on different datasets show that, compared to the advanced LSM-tree (Bourbon), Labor can reduce the latency by 29.6%-37.3% in the mixed read-write case and 39.4%-46.0% in the write-only case, while maintaining read-only performance.