The full picture
| Guarantee | Anomaly it kills | Typical fix |
|---|---|---|
| Read-your-writes | your own post disappears on refresh | read from leader for N seconds after write; or LSN token |
| Monotonic reads | refresh shows older data than the last refresh | sticky session to one replica; or remember highest LSN seen |
| Monotonic writes | your rename lands before your create | same-session ordering; single connection or sequence numbers |
| Writes-follow-reads | your reply is stored before the message you replied to | propagate causal token with the write |
// The write returns the replication position it committed at.
CommitToken token = repo.save(comment); // e.g. Postgres LSN, Mongo operationTime
session.setAttribute("readAfter", token); // carry it with the session/cookie
// Later reads pass the token; the replica either waits for it or is skipped.
List<Comment> visible = repo.findByPost(postId, session.readAfter());
// Postgres 14+: SELECT pg_wal_replay_wait / recovery_min_apply_delay checks
// Mongo: readConcern: { afterClusterTime: <ts> }
// The point: correctness is a data dependency, not a routing accident.- Why sticky routing is the fragile fix: it works until the replica dies, the load balancer reshuffles, the user opens a second tab, or they switch from mobile data to Wi-Fi. It's a good 80% mitigation and a bad correctness guarantee — say both.
- 'Read from the leader for 60 seconds' is the pragmatic default and it's what most teams actually ship. Be explicit about its cost: a burst of writes drags read traffic back onto the leader, which is exactly when the leader is busiest — the mitigation and the load spike arrive together.
- Cross-device breaks the session abstraction: the user writes on their phone, reads on their laptop. There is no session to be sticky to, so only a token carried in the account (or genuinely linearizable reads) fixes it. Naming this case unprompted is a strong signal.
- These guarantees compose into causal consistency: read-your-writes + monotonic reads + monotonic writes + writes-follow-reads is per-session causality. That's the tidy way to link this question back to the spectrum.