Introduction: The Write Amplification Problem
For decades, database architects have navigated a fundamental trade-off: the structural simplicity and read efficiency of B-trees versus the write performance and space efficiency of Log-Structured Merge-trees (LSM-trees). B-trees suffer from significant Write Amplification (WA). Because B-trees update data in-place, even a minor change to a single record often necessitates rewriting an entire 8KB or 16KB page to storage.
As shown in the figure above, traditional B-tree implementations like WiredTiger exhibit far higher write amplification than LSM-trees like RocksDB. This gap has led many modern systems to favor LSM-trees, despite their background "compaction" overhead and increased complexity.
The Opportunity: Transparent Compression
This paper proposes a paradigm shift: rather than trying to minimize logical writes in software, we can exploit modern hardware to minimize physical writes. Emerging Computational Storage Drives (CSDs) and advanced all-flash arrays feature built-in, hardware-accelerated transparent compression.
The key insight is that these drives can compress away "sparse" data—blocks filled with zeros—before they are physically written to the NAND flash. This means that while the OS sees a large logical write, the physical flash only records the non-zero data. This hardware-software co-design allows the database to be logically "wasteful" to achieve physical frugality.
The $B^-$-tree: Designing for Sparsity
The authors introduce the $B^-$-tree, which intentionally uses sparse logical data structures that are highly compressible. They propose three core techniques:
- Deterministic Page Shadowing: To ensure atomic writes without complex double-write buffers, the $B^-$-tree allocates two fixed slots for every page. It writes to one and sends a
TRIMcommand to the other. Hardware compression ensures the "empty" slot consumes virtually no physical space. - Localized Page Modification Logging: Instead of rewriting a full 16KB page for a small update, the $B^-$-tree writes a "delta" into a 4KB log block. The remainder of the block is padded with zeros, which the hardware compresses away.
- Sparse Redo Logging: Database logs are typically packed tightly to save space, leading to multiple rewrites of the same block. The $B^-$-tree instead pads every log flush to a 4KB boundary. Hardware compression makes this padding "free," ensuring each log record is physically written only once.
Evaluation and Results
The researchers tested the $B^-$-tree on a 3.2TB ScaleFlux CSD against RocksDB and WiredTiger. The results were transformative:
- Write Amplification: The $B^-$-tree reduced WA by over 10x compared to baseline B-trees. In random write tests (128B records), it achieved a WA of ~8, outperforming even RocksDB (~14).
- Throughput: The $B^-$-tree reached ~85K Transactions Per Second (TPS), significantly higher than RocksDB (~71K TPS) and WiredTiger (~28K TPS) under the same conditions.
- Storage Efficiency: Despite the sparse logical layout, physical storage usage remained comparable to LSM-trees due to the effectiveness of the hardware compression.
Conclusion
The $B^-$-tree demonstrates that by co-designing software with modern hardware features like transparent compression, we can overcome long-standing architectural limitations. By embracing logical "waste" to achieve physical endurance and performance gains, the $B^-$-tree effectively closes the write performance gap between B-trees and LSM-trees.
Summary updated