9:41
Write Path Trade-offs
B-Tree
Buffer pool
keys 1–64
keys 65–128
1–32
33–64
65–96
97–128
• Updates land in place
• Point reads in O(log n)
• Write amplification ~4.6x
LSM Tree
Memtable flush
L0
L1
L2
L3
L4
sst-0041 · 12 MB
sst-0038 · 96 MB
sst-0022 · 740 MB
• Writes stay sequential
• Merge cost paid on read
• Compaction runs nightly
Write-Ahead Log
Log head
segment 0142
segment 0143
• Durable before the ack returns
• Replayed from the last checkpoint
• Truncated once L0 is flushed
10
30