Key-Value Store
Build up a Dynamo-style store: partitioning, replication, quorums, versioning, failure detection, and repair. It puts the tradeoffs between consistency and availability into concrete read and write paths.
Lessons
- 01Define the key-value contractA small API still needs precise durability, size, and consistency promises.
- 02Partition the key spaceGive each key a predictable home while limiting movement when nodes change.
- 03Replicate across failure domainsKeep independent physical copies so one node does not own the only durable value.
- 04Choose read and write acknowledgmentsW and R determine how many replicas a coordinator waits for.
- 05Resolve concurrent versionsIndependent writers can update the same key without one obvious winner.
- 06Serve through temporary failureFailure suspicion, substitute replicas, and recovery each need a plan.
- 07Repair replica driftCompare data efficiently so long-lived divergence does not become permanent.
- 08Trace a local read and writeDurable acknowledgment depends on the path inside a replica.
- 09Test the promises under failureRouting, convergence, and durability must remain observable under stress.
Practice this chapter
- LabWhen can a quorum read return stale data?Choose N, W, and R, take replicas down, and see exactly when a read can miss the latest write.
- TaskDesign a session store for a global websiteApply key-value replication to short-lived data where reads dominate and a logout must not be undone by replication.