Monotonic Read Consistency
What you'll learn: How to prevent clients from traveling backward in time when reading replicated data.
The Time-Travel Problem
Imagine reading your bank balance and seeing 800—not because money was withdrawn, but because the second request hit a lagging replica that hadn't caught up yet. You'd panic, right?
Monotonic Read Consistency guarantees that once a client reads a particular version of data, all subsequent reads will return that version or a newer one—never an older one. You can't go backward in time.
How It Works
In replicated systems with asynchronous replication, different replicas may have different levels of freshness. Without monotonic reads, a load balancer might send your first request to an up-to-date replica and your second request to a lagging one, creating the illusion that data disappeared.
To enforce monotonic reads:
Sticky Sessions
Route a client's requests to the same replica consistently. If the replica fails, you need a fallback strategy.
Read-From Versioning
Track which version (timestamp or logical clock) the client last read. Only serve reads from replicas that have at least that version of data.
Wait for Lag
Before serving a read, ensure the replica has caught up to at least the version the client last saw. This adds latency but preserves consistency.
Real-World Example
Social media feeds use this: after you see your friend's new post, you shouldn't refresh and have it disappear just because you hit a different data center. The system ensures you always see "at least what you've already seen."
Key Takeaway: Monotonic Read Consistency prevents the jarring experience of seeing older data after newer data—clients always move forward (or stay put) in time, never backward.