Course contentsShow
← System Design
Lesson 373 of 1,91910. NoSQL: Key-Value StoresFree lesson

Replication and Quorum in Dynamo

How Dynamo replicates data across N nodes and uses quorum reads/writes (R+W>N) for tunable consistency.

Replication and Quorum in Dynamo

What you'll learn: How Dynamo uses replication across multiple nodes and quorum-based reads/writes to achieve tunable consistency guarantees.

The Core Idea

Dynamo doesn't store data on just one node—that would be a single point of failure. Instead, when you write a key-value pair, Dynamo replicates it to N successor nodes in the consistent hash ring (typically N=3). This means three copies of your data exist on different machines.

But here's the clever part: you don't always need to talk to all N nodes. Dynamo uses a quorum system where:

  • W = number of nodes that must acknowledge a write
  • R = number of nodes that must respond to a read
  • N = total number of replicas

The magic formula: R + W > N ensures consistency. If R=2 and W=2 with N=3, then any read will overlap with at least one node that has the latest write. You're guaranteed to see recent data.

Tunable Consistency

By adjusting R and W, you can dial consistency up or down:

  • High consistency: W=3, R=1 (all writes succeed everywhere before returning)
  • High availability: W=1, R=1 (fast, but may read stale data)
  • Balanced: W=2, R=2 with N=3 (common production setting)

Think of it like polling a jury: if you need 7 out of 10 jurors to agree (W=7), and you check with 4 jurors when reviewing (R=4), you're guaranteed at least one juror was in both groups (since 7+4 > 10).

Key Takeaway: Dynamo replicates data to N nodes and uses configurable quorum values (R and W) to let you trade off between consistency, availability, and latency based on your application's needs.