Appearance
Eventual Consistency
If no new updates are made to a piece of data, all nodes will eventually converge to the same value — given enough time.
Consistency Models (Spectrum)
| Model | Guarantee | Performance |
|---|---|---|
| Strong Consistency | All reads see latest write immediately | Slower |
| Read Your Writes | You always see your own writes | Medium |
| Monotonic Read | Never see older data than before | Medium |
| Causal Consistency | Causally related ops seen in order | Medium-fast |
| Eventual Consistency | Nodes converge eventually | Fastest |
How It Works Internally — Cassandra Example
Step 1: Write balance = 800 → Node 1 (acknowledged)
Step 2: Node 1 asynchronously syncs to Node 2, Node 3
Step 3: Read from Node 2 immediately → might see 500 (not synced yet)
Step 4: Read from Node 2 after sync → sees 800
Window of inconsistency = milliseconds usuallyConflict Resolution Strategies
- Last Write Wins (LWW): Highest timestamp wins. Simple but can lose data. Used by Cassandra default.
- Vector Clocks: Track causality between writes. More accurate but complex. Used by DynamoDB, Riak.
- CRDT (Conflict-free Replicated Data Types): Data structures that auto-merge. Counter: add all increments. Set: union of all sets. Used by Redis, Google Docs.
- Application-level Resolution: DB surfaces the conflict, application decides how to merge. Used by Amazon Dynamo.
When Acceptable vs Not Acceptable
| Acceptable (AP) | Not Acceptable (CP needed) |
|---|---|
| Social media likes/views | Bank balance |
| DNS propagation | Flight seat booking |
| Product catalog | Stock trading |
| User profile updates | Authentication tokens |
| Shopping cart (Amazon) | Financial transactions |