advanced
Read-after-write consistency
Guarantee users can see their own writes through routing, session stickiness, primary reads, or version-aware reads.
Read-after-write consistency guarantees users see their own updates immediately even if other users read stale replicas. Implement with primary reads for session owner, sticky routing to the writer node, version tokens passed on read, or client-side cache update on successful write.
Weaker than global strong consistency but critical for forms, settings pages, and posting flows where users refresh and expect their data.
On interviews: solve "user posts then refreshes feed" visibility, compare sticky sessions versus read-your-writes tokens.
Common pitfalls: load balancer sending reads to random replica after write; CDN caching personalized POST response; mobile offline queue replay confusing order.
The trade-off is flexibility versus complexity—know when the simpler path is enough.
Checklist:
- Identify flows needing own-write visibility.
- Route author reads to primary or fresh replica.
- Return version token on write for clients.
- Update client cache on successful mutation.