13 · Eventual Consistency — Soft-State Distributed Consistency Model¶
Performance & Distribution · Topic 13 of 13
What is Eventual Consistency?¶
In a distributed system, eventual consistency guarantees that if no new writes occur, all replicas will converge to the same value over time. There is no guarantee of when, only that it will happen.
Why Accept Weaker Consistency?¶
Strong consistency requires coordination (locks, consensus) which increases latency and reduces availability. Eventual consistency allows:
- Lower write latency (write to one node, propagate async)
- Higher availability during network partitions (AP systems)
- Geographic distribution without global consensus
Consistency Spectrum¶
graph LR
S[Strict / Linearizable] --> E[Sequential] --> C[Causal] --> M[Monotonic Read] --> EV[Eventual]
| Model | Guarantee | Example |
|---|---|---|
| Linearizable | Global real-time ordering | Google Spanner |
| Causal | Cause-before-effect ordering | MongoDB causal sessions |
| Read-your-writes | You see your own writes | DynamoDB ConsistentRead |
| Monotonic reads | Never reads older snapshot twice | Cassandra with tuning |
| Eventual | Only convergence guaranteed | Cassandra (ONE), DynamoDB (default) |
Conflict Resolution¶
When two replicas accept conflicting writes during a partition, they must resolve:
| Strategy | How | Used By |
|---|---|---|
| Last-Writer-Wins (LWW) | Highest timestamp survives | Cassandra, DynamoDB Global Tables |
| Vector Clocks | Track causality per node | Riak |
| CRDTs | Data types with merge rules designed for convergence | Purpose-built replicated counters/sets; ordinary sets are not automatically CRDTs |
| Application-level | App resolves on read | Shopping cart merge (Amazon's Dynamo paper) |
Cloud Implementations¶
- Default: eventual consistency
ConsistencyLevel.ONE— fastest, least consistent- Overlapping
QUORUMreads/writes can improve freshness; they do not alone provide linearizable compare-and-set semantics—use LWT where required
ConsistentRead: false(default) → eventually consistent, cheaperConsistentRead: true→ strongly consistent (for the local region)- Global Tables: distinguish multi-region eventual consistency (MREC) from multi-region strong consistency (MRSC); verify feature and regional constraints
- Strongly consistent by default; no eventual mode
- Stale reads available via bounded staleness for lower latency
- Secondary reads are eventually consistent
- Causal consistency via sessions:
session.advanceClusterTime()
Convergence Needs a Repair Mechanism¶
Eventual consistency is not a promise that data becomes fresh within a particular number of milliseconds. It relies on eventual communication, retained updates and a merge/repair mechanism. Define a measurable staleness SLO separately. Last-writer-wins can discard legitimate concurrent updates, especially with skewed clocks; convergence alone is not business correctness.
The spectrum above is a learning sketch, not a complete hierarchy: read-your-writes and monotonic reads are session guarantees, and causal ordering is not merely a freshness bound. Ordinary Redis sets are not automatically multi-writer CRDT sets. Specify the actual replicated data type and merge semantics before claiming conflict-free behavior.
Check Your Understanding¶
Source: DynamoDB consistency modes.