Vetora logo
Consistency & Transactions

Eventual Consistency

Eventual consistency is a consistency model guaranteeing that if no new updates are made to a data item, all replicas will eventually converge to the same value. It is the default model for many distributed databases (DynamoDB, Cassandra) and is the consistency counterpart to high availability in the CAP trade-off.

Overview

Eventual consistency is the weakest standard consistency guarantee for distributed systems, and also the most widely deployed. It states that if all writes to a data item stop, all replicas will eventually return the same value. The key word is 'eventually' -- the convergence time is typically milliseconds to seconds under normal conditions, but during network partitions or high load, it can stretch to minutes. During the convergence window, different clients reading from different replicas may see different values for the same key.

Eventual consistency is the natural result of asynchronous replication. When a write is acknowledged after being persisted on one node (the leader or coordinator), it is replicated to other nodes in the background. Until replication completes, replicas hold stale data. This is the trade-off at the heart of the PACELC theorem: even without partitions, choosing low write latency (asynchronous replication) means accepting eventual consistency. Synchronous replication provides stronger consistency but at higher latency and lower availability.

The practical implications of eventual consistency vary widely. For some applications, stale reads are harmless -- a social media feed showing a post 2 seconds late is invisible to users. For others, staleness causes real problems -- a banking application showing a stale balance after a deposit could lead to overdraft decisions. The challenge is not just the staleness window but the lack of ordering guarantees: without additional mechanisms, there is no guarantee about which version a replica returns. A replica might show value A, then value B, then value A again (if updates arrive out of order).

Stronger variants of eventual consistency address specific problems. Read-your-writes consistency (session consistency) ensures that a client always sees its own writes. Monotonic read consistency ensures a client never sees a value older than one it has already seen. Causal consistency ensures that causally related events are seen in order. These variants are strictly stronger than basic eventual consistency but weaker than linearizability, and most AP systems support one or more of them. CRDTs (Conflict-free Replicated Data Types) take a different approach: they define data structures where all concurrent operations commute, guaranteeing automatic convergence without conflict resolution.

Key Points
  • 1Eventual consistency is a liveness property: replicas WILL converge given time. It says nothing about how long convergence takes or what happens during the convergence window.
  • 2The convergence window is typically 10ms-2s under normal operation (bounded by network latency and replication lag). During partitions, it can extend to the partition duration plus reconciliation time.
  • 3Reads from different replicas may return different values during the convergence window. The application must tolerate this or use read-after-write routing (e.g., reading from the same node that processed the write).
  • 4Conflict resolution is the application's responsibility. When concurrent writes create divergent replicas, the system must converge to a single value via last-writer-wins (LWW), vector clocks + merge, or CRDTs.
  • 5Last-writer-wins (LWW) is the simplest conflict resolution but can silently drop writes. If two clients concurrently write different values, only the 'latest' (by timestamp or version) survives. LWW is safe for idempotent operations but dangerous for non-idempotent ones.
  • 6CRDTs guarantee convergence without coordination by restricting operations to those that are commutative, associative, and idempotent. Examples include G-counters (grow-only), PN-counters (add/subtract), OR-sets (observed-remove), and LWW-registers.
Simple Example

Social Media Like Count

A post has 100 likes. User A likes it (replica 1 says 101). User B likes it at the same time (replica 2 says 101, not knowing about A). Replica 1 replicates to replica 2 and vice versa. With LWW, one write overwrites the other -- the count stays at 101 instead of 102 (a lost update). With a CRDT counter, both increments are preserved during merge, and all replicas converge to 102. The convergence window might be 50ms, but during that window, different users see different counts.

Real-World Examples

Amazon DynamoDB

DynamoDB's default read consistency is eventually consistent. Reads go to any replica and return whatever value is locally available, typically within 1-2ms. Strongly consistent reads (routed to the leader partition) are available at higher latency (~5-10ms) and double the read cost. For most use cases (product catalog, user preferences, session data), eventually consistent reads provide sufficient freshness with lower latency and cost.

Apache Cassandra

Cassandra provides tunable consistency via per-query consistency levels. A write with CL=ONE and read with CL=ONE is eventually consistent (fastest, highest availability). CL=QUORUM for both reads and writes provides strong consistency (read quorum + write quorum > replication factor). Read-repair runs in the background to fix stale replicas detected during QUORUM reads. Anti-entropy repair (nodetool repair) periodically reconciles all replicas.

Amazon S3

S3 was eventually consistent for overwrite PUTs and DELETEs until December 2020, when Amazon upgraded to strong read-after-write consistency for all operations. Before the upgrade, reading an object immediately after overwriting it could return the old version. The upgrade was achieved by restructuring S3's internal metadata layer, not by switching to synchronous replication -- demonstrating that eventual consistency can sometimes be upgraded to strong consistency through engineering investment.

Trade-Offs
AspectDescription
Availability vs FreshnessEventually consistent systems remain available during partitions and provide low-latency reads from any replica. The cost is that reads may return stale data during the convergence window. For applications where freshness is critical (financial balances, inventory counts), this trade-off is unacceptable without additional guarantees.
Write Throughput vs Conflict RateAsynchronous replication enables high write throughput because writers do not wait for cross-replica confirmation. But if multiple replicas accept concurrent writes to the same key, conflicts arise and must be resolved. Higher write rates to the same keys increase the conflict rate and the complexity of resolution.
Simplicity vs Application ComplexityEventual consistency is simple for the database to implement -- just replicate asynchronously. But it shifts complexity to the application, which must handle stale reads, out-of-order updates, and conflict resolution. The total system complexity may not decrease; it is merely redistributed.
Latency vs Consistency SpectrumBetween eventual consistency and linearizability lies a spectrum: read-your-writes, monotonic reads, causal consistency, bounded staleness. Each provides stronger guarantees at the cost of additional coordination. Choosing the right level for each operation minimizes unnecessary latency while maintaining application correctness.
Case Study

Amazon S3's Upgrade from Eventual to Strong Consistency (2020)

Scenario

For its first 14 years, Amazon S3 provided eventual consistency for overwrite PUTs and DELETEs. After uploading a new version of an object, a GET might return the old version for several seconds. This caused problems for data lake workloads (Spark, Hive) that wrote data files and immediately listed or read them. Workarounds included adding delays, using S3Guard (a DynamoDB-backed metadata cache), and structuring workflows to avoid read-after-write patterns.

Solution

Amazon re-architected S3's internal metadata subsystem to provide strong read-after-write consistency for all operations, at no additional cost or performance penalty. The key insight was to make the metadata path strongly consistent (using internal consensus mechanisms) while keeping the data path asynchronous. A PUT is acknowledged only after the metadata is durably committed to a strongly consistent store, so subsequent GETs and LISTs always reflect the latest state.

Outcome

The December 2020 launch eliminated an entire class of bugs for S3 users. Data lake frameworks no longer needed S3Guard or delay hacks. The upgrade was backward compatible -- no API changes, no new consistency options. Importantly, read latency did not increase measurably, disproving the assumption that strong consistency necessarily costs performance. The S3 team estimated that the change required years of internal engineering to achieve without a performance regression.

Common Mistakes
  • Treating eventual consistency as 'no consistency.' Eventually consistent systems DO converge -- just not immediately. The convergence window is typically milliseconds under normal conditions. The question is whether your application can tolerate that window.
  • Assuming all eventually consistent databases have the same behavior. Cassandra, DynamoDB, and Riak have very different conflict resolution strategies, consistency tuning options, and convergence characteristics. 'Eventually consistent' is a broad category, not a specific behavior.
  • Not implementing read-your-writes consistency for user-facing features. If a user updates their profile and immediately views it, showing the old profile is a poor experience. Route the user's reads to the same node that processed their writes (session affinity) or use a strongly consistent read.
  • Using last-writer-wins without understanding the implications. LWW silently discards concurrent writes, which is fine for idempotent operations (set a flag, update a timestamp) but catastrophic for non-idempotent ones (increment a counter, append to a list). Use CRDTs or application-level merge for non-idempotent operations.
Related Concepts

See Eventual Consistency in action

Explore system design templates that use eventual consistency and run traffic simulations to see how these concepts perform under real load.

Browse Templates

Watch eventual consistency convergence in a social feed

Metrics to watch
convergence_time_msstale_read_pctthroughput_rpsreplication_lag_ms
Run Simulation
Test Your Understanding

1What does eventual consistency guarantee about read values during normal operation?

2Which conflict resolution strategy can silently lose concurrent writes?

Deeper Reading