A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Read-After-Write Consistency

Graduate Depth 98 in the knowledge graph I know this Set as goal
13topics build on this
364prerequisites beneath it
See this on the map →
Consistency Models in Distributed SystemsCausal ConsistencySequential Consistency
consistency session-consistency guarantees

Core Idea

Read-after-write (RaW) consistency, also called session consistency, guarantees that if a client writes data, all its subsequent reads will reflect that write. This is weaker than linearizability but captures a natural expectation: 'I just wrote my profile, I should see it when I reload.' It is often sufficient for user-facing applications.

Explainer

From your study of consistency models, you know that distributed systems offer a spectrum of guarantees ranging from strong (linearizability) to weak (eventual consistency). Read-after-write consistency sits in a practical sweet spot on this spectrum: it guarantees that after you write a value, your own subsequent reads will always see that write — but it makes no promises about what other clients see. This is sometimes called session consistency because the guarantee is scoped to a single client's session rather than the entire system.

Consider a concrete scenario. You update your display name on a social media platform. The write goes to a primary database node and begins replicating to read replicas. If your very next page load hits a replica that has not yet received the update, you see your old name — even though you just changed it. This feels broken, even though the system is technically functioning correctly under eventual consistency. Read-after-write consistency eliminates exactly this class of surprise: the system ensures that your reads always reflect your own prior writes, even if the underlying replication has not fully propagated.

There are several common implementation strategies. The simplest is read-your-writes routing: after a client performs a write, the system routes that client's subsequent reads to the node that processed the write (often the primary) for a brief window, then falls back to replicas once replication has caught up. Another approach uses logical timestamps or version vectors: the client remembers the version of its last write, and any replica serving a read must have at least that version before responding — otherwise the request is forwarded or delayed. A third approach uses sticky sessions, pinning a client to a specific replica so that reads and writes flow through the same node.

The key insight is that read-after-write consistency is dramatically cheaper than linearizability while eliminating the most common user-visible anomaly in replicated systems. Linearizability requires global coordination on every operation, which imposes latency and reduces availability. Read-after-write only requires coordination within a single client's session — a much smaller scope. This is why it appears so frequently in practice: systems like Amazon DynamoDB, MongoDB, and most cloud databases offer read-after-write guarantees as a default or configurable option, because it matches user expectations without the performance cost of full strong consistency.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockLogical Clocks and Event OrderingVector Clocks and Capturing CausalityHappened-Before Relation and Causal OrderingConsistency Models in Distributed SystemsRead-After-Write Consistency

Longest path: 99 steps · 364 total prerequisite topics

Prerequisites (1)

Leads To (2)