Design a key-value store
DatabricksSoftware Engineer · OnsiteLast updated
This question evaluates understanding of durable storage and crash-consistency, including on-disk data layout, filesystem durability semantics, concurrency control, and performance trade-offs for single-node embeddable key–value engines.
Design a durable key-value store that supports put(key, value), get(key), and delete(key). Specify how you will achieve durability with a write-ahead log (WAL), lay out on-disk data structures, and perform crash recovery. Describe compaction/garbage collection, fsync/batching strategy, and handling of torn writes. Explain your concurrency model: single-writer/multi-reader vs. multi-writer, lock-based vs. optimistic/lock-free approaches, and how you ensure correctness under concurrent access. Analyze consistency guarantees (e.g., read-after-write), latency/throughput trade-offs, and back-of-the-envelope resource estimates. Provide a minimal testing plan covering failure injection and recovery.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.