#📝 Note: Consistency Models
#Overview
Consistency models define the rules for how data updates are perceived by different nodes in a distributed system.
#Key Models
- Strong Consistency: After an update, all subsequent reads return the updated value.
- Eventual Consistency: If no new updates are made, eventually all reads will return the last updated value.
- Read-Your-Writes Consistency: A process that updates a record will always see the updated value in subsequent reads.
- Monotonic Reads: If a process has seen a value, it will never see an older value in subsequent reads.
#PACELC Theorem
An extension of the CAP theorem.
- If there is a Partition: trade-off between Availability and Consistency.
- Else (no partition): trade-off between Latency and Consistency.
#When to Choose
- Strong: Financial systems, inventory (to prevent overselling).
- Eventual: Social media feeds, product reviews, search indices.