PRO

Effect LSM Memtable Compaction

A log-structured merge tree so random writes become sequential appends. Updating rows in place makes a write-heavy workload thrash on scattered seeks; an LSM appends every write to an in-memory memtable that flushes as one sorted immutable SSTable, so writes are sequential regardless of key order. Reads walk memtable then newest-to-oldest segment and stop at the first hit, and a delete is a tombstone that masks older values rather than a gap that lets them resurrect. Background compaction merges segments newest-first, dropping obsolete versions and tombstones to bound read cost. The demo proves newest-wins across segments and compaction collapsing three segments to one. Pinned to effect 4.0.0-beta.98.

Install
npx shadcn@latest add @compronents/effect-lsm-memtable-compaction

Installs from ui.aryank.space. Needs a registry token and a one-time @compronents entry in components.json. The docs walk through both.

Visualization
read
get k (deleted)
string
read old SSTable -> deleted key comes back

If a delete just stops writing, an old copy of the key still sits in an older SSTable and resurrects on the next lookup. Immutable segments make silent gaps dangerous.

Files
Checking access…
Dependencies