What it is
Eventual consistency is the weakest useful guarantee for replicated data: if no new updates are made to an item, eventually all accesses to it return the last updated value (Werner Vogels’ formulation). Replicas may disagree for a while; they must converge once the writes stop.
That is a liveness guarantee only. It says nothing about how long convergence takes or what reads return before then. A read may return any recent value, and two successive reads may even go backwards.
Why it exists
Coordination costs latency and, during partitions, availability (CAP, PACELC). If replicas answer from local state and propagate changes in the background, every read and write is as fast as one node and keeps working when the network splits. For most data (feeds, catalogues, counters, profiles, caches, DNS) a short delay before everyone sees a change is acceptable.
How it works
Asynchronous propagation. A write is confirmed by one node (a primary, or any node in multi-leader and leaderless systems) and shipped to the others afterwards, through a replication log, gossip, or hinted handoff.
The inconsistency window. Between the confirmation and the moment a replica applies the change, a read on that replica returns the previous value. The window is the replication lag: milliseconds on an idle local network, seconds under load, much longer while a replica is down or partitioned. Hot keys, written often, spend most of their time inside a window.
Convergence. Replicas converge when every update has reached every replica and all replicas apply updates with the same outcome. Single-leader replication gets that from the log order. With several writers, mechanisms are needed:
- Anti-entropy: replicas compare data (e.g. Merkle trees) and exchange what differs; read repair fixes divergent replicas noticed during reads.
- Conflict detection: version vectors (or dotted version vectors) tell “B replaced A” apart from “A and B were concurrent”.
- Conflict resolution: last write wins keeps the highest timestamp and discards the other write; CRDTs (counters, sets, maps, registers) merge any concurrent updates deterministically; siblings return all concurrent versions for the application to merge.
Session guarantees (Terry et al., 1994) strengthen what one client sees without global coordination:
- Read-your-writes: a client always sees its own writes. Route its reads to the primary for a while after a write, or send the write’s log position and read only from replicas that have reached it.
- Monotonic reads: a client never sees an older version than one it has seen. Stick the session to one replica, or send the newest version seen.
- Monotonic writes and writes-follow-reads keep a client’s own writes, and writes that depend on what it read, in order.
Together these, and causal consistency more generally, can stay available during partitions while avoiding the anomalies users notice.
When to use it
Read-heavy, latency-sensitive data where a brief delay is harmless: social feeds, like and view counts, product catalogues, search indexes, recommendation results, user profiles (with read-your-writes), shopping carts (with a merge rule), presence, metrics. Multi-region and offline-first systems often have no practical alternative for most of their data.
When not to
Anything protected by an invariant across clients: account balances with limits, inventory that must not oversell, unique usernames, locks and leader election, idempotency records for payments. A stale read there causes wrong decisions, not just old screens. Use a strongly consistent store (or a strongly consistent path) for those few operations.
Trade-offs
| Choice | You gain | You pay |
|---|---|---|
| Async replication, read anywhere | Low latency, scale-out reads, availability during partitions | Stale reads, possible loss of acknowledged writes on failover |
| Add read-your-writes | Users see their own changes | Session routing or position tracking |
| Add monotonic reads | Time never goes backwards for a user | Sticky sessions or version tokens |
| Last write wins | Simple convergence | Silently drops concurrent writes; depends on clocks |
| CRDTs | Convergence without lost updates | Limited data types, metadata overhead, harder deletes |
Alternatives
- Strong consistency (linearizability) where correctness needs it.
- Bounded staleness: reads guaranteed at most t seconds or k versions behind (offered by several cloud databases and distributed SQL follower reads).
- Causal consistency: preserves cause-before-effect order (a reply never appears before its question) and remains available.
- Single-region writes with async read replicas: avoids conflicts entirely; staleness remains.
Failure modes
- “Saved but gone”: a user’s read after a write hits a lagging replica.
- Flickering data: successive reads alternate between replicas at different positions.
- Unbounded lag: a slow or recovering replica serves very old data while looking healthy.
- Silent lost updates: last write wins with concurrent writes or skewed clocks.
- Resurrected deletes: a replica that missed a delete (tombstone expired before it caught up) reintroduces the item.
- Lost writes on failover: promoting a lagging replica drops confirmed writes it never received.
In production
Monitor replication lag per replica and alert against an explicit budget; take replicas out of read rotation when they exceed it. Implement read-your-writes for user-facing writes (primary-after-write window or position tokens). Use sticky routing or version tokens where flicker would confuse users. In multi-writer systems choose CRDTs or sibling resolution for data where updates must not be lost, and keep tombstones longer than the longest expected replica outage. Document which data is eventually consistent so product teams can design around it.
Common misconceptions
- “Eventually means within a second.” There is no bound unless you build and monitor one.
- “Eventual consistency means data may be wrong.” Reads return values that were written; they may be out of date, not invented (unless merges lose data).
- “If it converges, no writes were lost.” Last write wins converges by discarding writes.
- “Strong or eventual, nothing in between.” Session guarantees, causal consistency and bounded staleness sit between.
Interview angle
Say what the guarantee is (convergence when writes stop, no time bound), then show you know its practical faces: replication lag as the inconsistency window, read-your-writes and monotonic reads as cheap fixes, and conflict resolution when more than one node accepts writes (last write wins versus CRDTs or version vectors). Close by scoping: feeds, counters and catalogues eventually consistent; balances, inventory reservations and uniqueness on a strongly consistent path.
Model assumptions
The simulated steps use a simplified model, not a benchmark. The app sends 150 requests per second (15% writes over 40 keys, Zipf 1) through a database proxy that sends writes to the primary and spreads reads over three replicas. Each database has 12 connections, 10 ms reads and 10 ms writes. Replication is asynchronous: replicas apply a change about 300 ms after the primary confirmed it (2 s in the backlog step). A stale read is a replica read that misses a write the primary already confirmed. “Writes stop” switches the app to reads only. The engine routes every read independently (no sessions) and has a single writer, so the read-your-writes, monotonic-reads and conflict steps are scripted illustrations. Numbers show behaviour and orders of magnitude only.