Consistency models and eventual consistency
In short: Consistency models define which values a read may see in a distributed system. From “always the latest” (strong) to “equal eventually” (eventual).
In more detail: The stronger the guarantee, the more coordination and latency. Weaker models are faster and more available but require the application to cope with stale or conflicting values.
In Depth
- Linearizability: Every operation appears to take effect at one instant, everyone sees the same order. Strongest guarantee.
- Sequential consistency: Everyone sees the same order, but not necessarily in real time.
- Causal consistency: Cause before effect is preserved.
- Eventual consistency: Without new writes all replicas converge eventually.
- Session guarantees: Read-your-writes, monotonic reads.
- Practice: A bank booking needs strong, a like counter is fine with eventual.
See also: CAP theorem, CRDTs: conflict-free replicated data types