What is Eventual Consistency?
Eventual consistency, told as a story about a stock board that takes a moment to catch up with the warehouse.
New stock just arrived, but the counter's board still shows the old number.A guest asks, 'you said it was sold out?'
Why: syncing the copies to match takes a brief moment.Syncing the replicas takes a brief moment.
Even if it's off at first, wait a little and it ends up matching.In between, it can be slightly different.
Timeline: t=0 update → t=1 still stale → t=3 matches.It takes a little time before every number matches.
Without knowing how long 'eventually' takes, guests get more confused.So you need to promise a time.
Eventual consistency: replicas won't match right away, but wait a little and they end up the same — in between, they can briefly differ.
This contrasts with strong consistency, where every replica always matches. Knowing the replication lag lets you tell guests when things will line up. It's usually avoided for money, and used instead for low-stakes things like caches or view counts.
When grown-ups say it
- Eventual Consistency
- The promise that things match up eventually, even if a bit late. Mostly used for low-stakes information.
- Strong Consistency
- Always showing the latest, correct answer. Used wherever money is involved. → you can't have both correctness and always-open
- Replication Lag
- The time it takes a replica to catch up to the original. → keeping the same guest list in two warehouses
- Read-your-writes Consistency
- The promise that at least your own change shows up for you right away. Less confusing for guests than plain eventual consistency.
- Vector Clock
- A label-like tool for telling which replica is more recent. The details live elsewhere — just know the name for now.
- Conflict Resolution
- The rule for settling conflicting values into one. Last-write-wins, manual merge, and others are common approaches.
- Caching
- A memo board with answers written down in advance. → the memo board with answers written in advance
- CAP Theorem
- What you get when CAP's trade-off picks availability. → you can't have both correctness and always-open