Strong consistency: once a write is acknowledged (confirmed), every later read returns that value or a newer one. This is true for any client and any replica. The system behaves as if there is only one copy of the data. It costs latency and availability, because replicas must coordinate before they answer.
Eventual consistency: replicas may return stale (old) values for a while. But if writes stop, all replicas converge to the same value. A replica can serve reads and writes locally and fast. The system stays available during failures.
Use strong consistency where stale data causes real harm:
- account balances
- reserving the last item in stock
- making sure usernames are unique
Eventual consistency fits cases where a few seconds of stale data is acceptable:
- like counts
- view counters
- social feeds
- search indexes
- analytics
- With strong consistency, reads see the latest acknowledged write.
- With eventual consistency, reads may be stale, but replicas converge when writes stop.
- Strong consistency costs latency and availability.
- Use strong consistency for money, stock and unique values.
- Use eventual consistency for counters, feeds and search.
Read more