Key-Value Stores & the Dynamo Model
Two operations, get and put, and a design built around scaling that simplicity to enormous throughput.
Intermediate
get(key) and put(key, value) — and treats the value as an opaque blob it doesn't need to understand. No joins, no schema, no query language. That simplicity is the whole point: it's what lets a key-value store scale to a scenario like storing an active session for every one of PlateRoute's currently-online users, where the access pattern is always "fetch by exact ID" and never "find all sessions where...".| Requirement | What it demands |
|---|---|
| Configurable consistency | Different applications tolerate different staleness — the store should let each caller choose, rather than forcing one fixed guarantee on everyone. |
| Always writable | Per the CAP theorem, favoring availability (A) over consistency (C) means a write should nearly always succeed, even mid-partition, accepting that conflicting versions may need to be reconciled later. |
| Hardware heterogeneity | New servers, possibly with more capacity than old ones, should join the cluster without a special migration step. |
| Incremental scalability | Adding or removing a server should cause minimal data movement — this is exactly what consistent hashing is for. |
n replicas of each key, a write must be acknowledged by w of them and a read must query r of them; choosing w + r > n guarantees every read overlaps with at least one replica that has the latest write.
n = 3, w = 1, r = 1 -> fastest, most available, weakest consistency (w+r=2, no overlap guarantee)
n = 3, w = 2, r = 2 -> balanced: w+r=4 > n=3, strong overlap guarantee, moderate latency
n = 3, w = 3, r = 1 -> slow writes, fast strongly-consistent-ish reads