Read-After-Write Consistency

Replica lag matters.

Overview

Read-after-write consistency ensures that a user who just wrote a value can immediately read it back. Naive replica routing breaks this expectation: the user writes to the primary, the read load-balances to a replica, the replica has not yet replicated the write, the user sees the old value and reports a "bug" that is actually replica lag. The discipline is to recognise the problem, route read-after-write paths to primary briefly, and pick a strategy that matches the user expectation rather than fight it.

The approach

The practical approach is to route read-after-write paths to primary for a brief window (matched to typical replication lag, usually 1-5 seconds), use session affinity (cookie or token) where the user’s subsequent reads need to land consistently, monitor replica lag continuously so routing logic can adapt, document the per-table consistency expectation, and test the consistency model with synthetic tests before production.

Why this compounds

Read-after-write discipline compounds across features. Each correctly-routed read preserves user trust; each documented consistency expectation supports debugging the next user-reported "bug" that is actually a consistency issue; the team builds intuition for distributed-systems consistency that pays off on every new feature.

Read-after-write consistency is a distributed-systems discipline that pays off across years. Nova AI Ops integrates with database telemetry, surfaces consistency patterns, and supports the team’s consistency discipline.