Eventual Consistency
In one line
Eventual consistency: replicas may be temporarily inconsistent but will eventually converge — AP systems like Cassandra.
In simple words
Eventual consistency is a consistency model where replicas may temporarily return stale data, but if no new updates are made, all replicas will eventually return the same value.
This is the 'A' in CAP — the system remains available during network partitions, accepting writes on any node. Those writes propagate to other replicas eventually (via anti-entropy, read repair, or hinted handoff).
Trade-offs:
- Stale reads — you might read an older value before replication completes
- Conflict resolution — concurrent writes to different replicas need merging (last-write-wins, vector clocks, CRDTs)
- High availability — the system never rejects reads/writes due to partition
Used by: Cassandra, DynamoDB (eventually consistent mode), S3, DNS. Good for social media, shopping carts, counters. Bad for banking, inventory, anything requiring strict consistency.
Contrast with strong consistency: reads always return the latest write, but the system may be unavailable during partitions.
Example
Eventual Consistency Example:
Time 0: Node A: balance=100 Node B: balance=100
Time 1: User writes to Node A: balance=50
Node A: balance=50 Node B: balance=100 (stale!)
Time 2: User reads from Node B: gets 100 (STALE)
(replication hasn't happened yet)
Time 3: Replication occurs
Node A: balance=50 Node B: balance=50 (converged)
Time 4: User reads from Node B: gets 50 (consistent)
Cassandra example:
CONSISTENCY LEVEL ONE → fastest, may be stale
CONSISTENCY LEVEL QUORUM → reads from majority
CONSISTENCY LEVEL ALL → slowest, always consistentEventual consistency: Node B may return stale data (100) before replication. Eventually both nodes converge to 50. The system stays available during the gap.
Common confusions
Confused with: strong consistency
The difference: Strong consistency guarantees every read returns the latest write — but may reject requests during partitions (CP). Eventual consistency allows stale reads but never rejects requests (AP). Strong is safer but less available; eventual is more available but may return old data.
Related terms
Related Resources
Related Lessons
- Distributed Databases
Eventual consistency.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.