Consistency Models¶
Core question¶
After data changes in one location, when and where must other readers observe that change?
Key concepts¶
- Strong consistency
- Eventual consistency
- Read-after-write consistency
- Monotonic reads
- Causal consistency
- Session consistency
- CAP theorem
- PACELC
- Replication lag
- Conflict resolution
Architectural decision¶
Do not ask:
"Which database is better?"
Ask:
"What consistency guarantees does this business operation actually require?"
Design scenario¶
Design a globally distributed customer-profile service.
Compare:
- Strongly consistent design
- Eventually consistent design
Analyze:
- latency
- availability
- user experience
- failure behavior
- implementation complexity
- cost
Questions¶
- Can every operation use strong consistency?
- What business data can tolerate stale reads?
- What happens during a network partition?
- How are conflicting writes handled?