← Back to Labs

LSM Tree Lab

Follow one key from WAL to memtable to SSTable, then compare how leveled and tiered compaction pay for the same write history.

Compaction policyChoose which debt shape the engine prefers
WorkloadChoose whether compaction is mostly replacing values or carrying tombstones
Read checks
1 memtable, 0 SSTables
Write amp
1.0x
Space amp
1.2x
Snapshot state
no pinned snapshot
Internal key focus: tram:ath-17Leveled compaction · Athens tram telemetryWAL1 visible runwal-00987.logseq=880132 PUT tram:ath-17Memtable1 visible runmutable memtabletram:ath-17 -> speed=43Level 0no active run for this stepLevel 12 visible runssst-140tram:ath-17 -> speed=41sst-141Adjacent key range, no match for this lookupLevel 21 visible runsst-201tram:ath-17 -> speed=38Lookup pathNewest key version is not on disk yet for tram:ath-17.
Step 1 / 6The write lands in the WAL and the active memtable

An LSM engine first records the mutation in an append-only WAL, then inserts the same key into the current in-memory memtable so fresh reads can see it immediately.

The engine appended seq=880132 for tram:ath-17 to the WAL and inserted the same version into the mutable memtable.

A write is acknowledged long before it has a final home on disk.

Fewer candidate files per level, more bytes rewritten over time. Right now there is no compaction debt yet, only fresh state in RAM plus the recovery log.

Arrow keys to navigate · R to reset

Tap dots to jump to any step

Read the full article →Take the quiz →