Skip to content
StackDecode
System Design
5. Advanced Database Architecture6. Distributed Systems FundamentalsAnimated

Eventual Consistency

Replicas become identical given time and no new updates.

The idea

Reads may be stale for a moment, but all replicas converge.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

node 1value v1node 2value v1node 3value v1node 4value v1node 5value v1
  • latest
  • stale

5 replicas each hold the value v1. We choose W=3 (acks needed to write) and R=3 (replies needed to read).

N:
5
W:
3
R:
3
1/4

Change N, W and R to see when reads can be stale.

Step by step

  1. 1Write to one replica
  2. 2It propagates asynchronously
  3. 3Reads may see old data
  4. 4Eventually all agree

Where it is used

Social feeds, counters, DNS.

Watch out for

Anomalies are visible. Design the UI and logic for them.

Related