Consistency Patterns
TL;DR
Strong: All nodes see same data immediately. Eventual: Nodes converge over time. Causal: Related events seen in order. Trade-off: Consistency vs availability (CAP theorem).
Consistency Models
| Model | Guarantee | Latency | Use Case |
|---|---|---|---|
| Strong | Always latest value | High | Banking, inventory |
| Eventual | Converges eventually | Low | Social media, DNS |
| Causal | Cause before effect | Medium | Chat (reply after message) |
| Session | Your writes visible to you | Low | Shopping cart |
Strong Consistency
Cost: High latency (wait for sync replication)
Eventual Consistency
Benefit: Low latency (don't wait for replication)
Quick Reference
- CAP theorem: CP (strong) or AP (eventual)
- Strong: Banking, inventory, voting
- Eventual: Social media, analytics, DNS