System Design Lab
A distributed key-value store trades consistency, latency, and availability by tuning how many replicas must agree.
Change throughput, key count, value size, replication factor N, read quorum R, write quorum W, and cluster size. The design moves from a single node to a consistent-hash ring, to replication, to quorum tuning (the CAP tradeoff made concrete), and finally to multi-region with anti-entropy. This mirrors Amazon Dynamo and Apache Cassandra.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
Consistent hashing partitions keys and limits reshuffling on membership change
Dynamo places keys on a ring by hash and uses virtual nodes so that adding or removing a node only moves a fraction of the keys, keeping load balanced.
Amazon Dynamo (SOSP 2007)Quorum R+W>N gives read-your-writes; smaller quorums favor latency and availability
Dynamo exposes N, R, and W as tunable knobs; R+W>N makes the read and write sets overlap so a read sees the latest write, trading off latency and availability.
Amazon Dynamo (SOSP 2007)Hinted handoff and read repair keep the store available and eventually consistent
Cassandra stores hints for unreachable replicas and repairs divergence during reads and via background anti-entropy, so failures do not block writes.
Apache Cassandra DocsDynamoDB is a managed key-value store with tunable, region-scoped replication
DynamoDB offers eventually and strongly consistent reads and global tables that replicate across regions, the same N/R/W tradeoffs as a managed service.
AWS DynamoDBTeaching assumptions
- Per-node op and storage budgets are conservative teaching numbers; real nodes vary widely by hardware and value size.
- Write amplification is modeled simply as the replication factor N β every put is applied to N replicas.
- Consistency pressure compares R+W to N; it abstracts away clock skew, sloppy quorums, and hinted writes.