Read, write & space amplification - B-Tree vs LSM
This post compares a B-Tree and LSM for read, write and space amplification . The comparison is done in theory and practice so expect some handwaving mixed with data from iostat and vmstat collected while running the Linkbench workload . For the LSM I consider leveled compaction rather than size-tiered compaction. For the B-Tree I consider a clustered index like InnoDB. The comparison in practice provides values for read, write and space amplification on real workloads. The comparison in theory attempts to explain those values. B-Tree vs LSM in theory Read Amplification Most comparisons should be done for a specific context including the hardware and workload. For now I am only specific about the cache hit rate. For the B-Tree I assume that all non-leaf levels are in cache. For the LSM I assume that everything but the data blocks of the largest LSM level are in cache. While an LSM with leveled compaction has more things to keep in the cache (bloom filters) it also benef