Why Bitcask cannot give you ranges
If you want both fast writes and ordered reads on more keys than fit in RAM, neither a hash-in-RAM (Bitcask) nor a B-tree on disk wins — and that gap is the entire reason an LSM (Log-Structured Merge-tree, the engine inside LevelDB / RocksDB / Cassandra) exists.
Scene 01
Why Bitcask cannot give you ranges
- Watch
- Try it
- Predict
- Capture
One workload of random-key writes drives three panels. Watch the first two panels die in turn — first on cardinality, then on write rate. The third panel is the empty slot we fill next.
Highlighted lines are the ones running in the diagram right now.
# we want a single store that satisfies all of these:store.put(key, value) # at memory speedstore.get(key) # bounded latencystore.scan(from_key, to_key) # ordered range# subject to:# key_count > RAM_BUDGET / row_overhead# write_rate > disk_random_seeks_per_sec# Bitcask fails the first constraint (RAM ceiling).# B-tree fails the second (seek per random write).
Where this sits in Build an LSM-tree storage engine (LevelDB / RocksDB style)
Scene 01 of 11, in the The brief act — Why Bitcask cannot give you ranges.. Bitcask died on cardinality, the B-tree died on write rate. The brief LSM is built to satisfy: ordered reads, more keys than fit in RAM, no seek per write.
Up next. Bitcask died on cardinality, the B-tree died on write rate. The fix LSM (Log-Structured Merge-tree) takes is hiding in plain sight: write to RAM at memory speed AND append to a disk log for crash safety. Two structures, one truth — and we'll name them next scene.
All 11 scenes in Build an LSM-tree storage engine (LevelDB / RocksDB style) · Every curriculum