Problem
With asynchronous replication, a user writes to the leader and then reads from a replica that has not yet received the update. They see their change vanish and assume it failed. Global strong consistency is too costly just to fix this.
Also known as: read-after-write, session-consistency
Guarantee that a client always sees its own prior writes even when reads are served from lagging replicas.
With asynchronous replication, a user writes to the leader and then reads from a replica that has not yet received the update. They see their change vanish and assume it failed. Global strong consistency is too costly just to fix this.
Read-your-writes, or read-after-write, consistency ensures a client sees the effects of its own earlier updates. It is a session guarantee that sits between eventual consistency and linearizability, and fixes the common confusion where a saved edit seems to disappear after reload.
The write returns a position marker; subsequent reads only use replicas that have reached it.
POST /profile -> primary commits at LSN 4821
<- cookie: minLsn=4821
GET /profile -> router picks replica R
if R.replayLsn >= 4821: read from R
else: read from primary (or wait briefly)
Simpler variants route a user's reads to the primary for N seconds after any write, with N longer than typical replica lag. Dynamo-style stores achieve the effect by using quorum reads or sticky sessions. For multi-device users, store the last write position server-side keyed by user id.
Little beyond replica routing
Low to medium: monitor replica lag
Medium: tracking positions
Token lost across devices or after cookie expiry exposes stale reads
Lagging replica causes primary fallback spikes
Clock-based windows too short for actual replication lag