What is eventual consistency in distributed systems
· Category: System Design
Short answer
Eventual consistency means that if no new updates are made, all replicas will eventually converge to the same value. Reads may return stale data temporarily, but the system becomes consistent over time. For the theoretical foundation, see what is the CAP theorem and why does it matter.
When to accept eventual consistency
- Social media feeds (showing a post a few seconds late is acceptable)
- DNS propagation (changes take time to spread globally)
- Shopping cart counts (temporary inconsistency is tolerable)
- Product review counts (exact number is not critical)
When you need strong consistency
- Financial transactions (balances must be exact)
- Inventory management (prevent overselling)
- Authentication (must be immediately consistent)
Conflict resolution
- Last write wins: Use timestamps, but clocks can drift
- Vector clocks: Track causal relationships between writes
- Application-level merge: Custom logic to resolve conflicts
Tips
- Design your application to handle stale reads gracefully with retry logic
- Use read-repair and anti-entropy protocols to speed up convergence
- For caching strategies related to consistency, see how caching improves system performance