Course contentsShow
← System Design
Lesson 536 of 1,91915. Consistency ModelsFree lesson

Monotonic Writes

Learn monotonic writes: writes from a single client are applied in the order they were issued across replicas.

Monotonic Writes

What you'll learn: How monotonic writes guarantee that a client's own updates are applied in the exact order they were issued, even across different replicas.


The Core Idea

Monotonic writes is a consistency guarantee stating that if a single client performs multiple write operations, those writes will be applied to all replicas in the same order they were issued. No replica will see a later write before an earlier one from the same client.

This prevents causality violations where your second update might arrive before your first, creating nonsensical states.

Why This Matters

Imagine you're editing a shared document. You write "Hello" first, then append " World" second. Without monotonic writes, one replica might receive the append operation before the initial write, trying to append to nothing—or worse, storing "World" before "Hello" appears.

With monotonic writes guaranteed, every replica processes your changes in order: "Hello" always arrives before " World".

Plain English Example

Think of sending letters through the postal system. Monotonic writes is like guaranteeing that if you mail three numbered letters (1, 2, 3) to someone, they'll read them in order even if they use multiple mailboxes. Letter 3 won't be read before letter 1, even though different mailboxes (replicas) might receive them at different times.

How It Works

The system tracks a logical sequence or timestamp for each client's writes. Before applying a write to a replica, the system checks: "Have all earlier writes from this client been applied here?" If not, it waits or fetches the missing writes first.

Key Takeaway: Monotonic writes ensure that a single client's write operations are never reordered across replicas, preserving the client's intended causality and preventing impossible states.