Design a distributed key-value store like Amazon Dynamo or Cassandra
A distributed key-value store (Dynamo, Cassandra, Riak) trades rich queries for horizontal scale and availability. Every design choice is about the CAP and PACELC trade-offs: how many replicas must answer a read or a write, what happens during a partition, and how replicas converge afterwards.
Storage & Data, 8 components, about 50 min
The full guide covers requirements, estimates, the API, the data model, deep dives, trade-offs, failure modes and the follow-up questions interviewers ask.
Read the full guide on SubstackKey points
- Consistent hashing with virtual nodes spreads keys and moves about 1/N of data when a node joins.
- Each key lives on N replicas; R + W > N gives read-your-writes on a single key, W = 1 favours availability.
- Storage engine is an LSM tree: append to a commit log and memtable, flush to SSTables, compact in the background.
- Conflicts from concurrent writes are resolved by last-write-wins timestamps or exposed as siblings with vector clocks.
- Anti-entropy: hinted handoff for short outages, read repair on reads, Merkle-tree comparison for the rest.
Sign in to track this guide in your curriculum progress.