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 Systems→→Causal 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 Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Kernel Architecture and OS Structure → System Calls and User/Kernel Mode → Processes and the Process Control Block → Logical Clocks and Event Ordering → Vector Clocks and Capturing Causality → Happened-Before Relation and Causal Ordering → Consistency Models in Distributed Systems → Read-After-Write Consistency

Longest path: 99 steps · 364 total prerequisite topics

Prerequisites (1)

Leads To (2)