System Design Academy

Saving…

Lesson 7 of 10 in Module 50 of 54 lessons complete

Consistency Models

Module 5, lesson 7Concept12 min

Definition

Consistency model

In plain English
A consistency model is the promise a system makes about how up to date and in what order reads will see writes.
Think of it like
It is like a newspaper's promise about how fresh its news is.

Strong consistency

In plain English
Strong consistency means every read sees the latest completed write, as if there were one copy of the data.
Think of it like
It is like a single shared whiteboard everyone looks at.

Linearizability

In plain English
Linearizability makes operations appear to take place one at a time, with each happening between its start and finish.
Think of it like
It is like one clerk handling requests in an order that respects which customers have already finished.

Eventual consistency

In plain English
Eventual consistency means copies may differ for a while but will match once updates stop arriving.
Think of it like
It is like news spreading through a village until everyone has heard.

Version number

In plain English
A version number identifies which revision of a value you are reading, with higher numbers marking later revisions.
Think of it like
It is like numbered drafts of a card, so draft twelve comes after draft eleven.

Why it exists

You save a flashcard edit, refresh, and see its old wording. Another read reaches a newer copy and your edit reappears.

Different promises prevent different surprises. In this lesson, strong consistency means linearizability.

The eventual-consistency definition assumes communication recovers and the system resolves competing changes. Waiting cannot repair permanently isolated copies.

How it works

Read-your-writes

In plain English
Read-your-writes guarantees that after you change something, your own reads show it — introduced in Module 3's replication lesson.
Think of it like
Like seeing your own post immediately after you publish it.

Monotonic reads

In plain English
Monotonic reads guarantee you never see older data after you've seen newer data.
Think of it like
Like a clock that never jumps backwards.

Causal consistency

In plain English
Causal consistency guarantees that if one update depends on another, everyone sees them in that order.
Think of it like
Like never seeing a reply before the message it answers.
PromiseWhat you can rely onTypical cost
StrongCompleted writes precede later reads in one shared operation orderCoordination and possible unavailability
CausalDependent updates appear in orderTrack dependencies; unrelated writes can differ
Read-your-writesYour later reads include your completed writesRoute or wait for your saved version
Monotonic readsYour session does not return to an older versionTrack the newest version already seen
EventualCopies converge after writes stop and repair completesReaders may see older values meanwhile

A viewer reads version eight from replica A, then receives older version seven after refreshing against replica B.

A later read must not move backwards under monotonic reads.

A viewer reads version eight from replica A, then receives older version seven after refreshing against replica B.

  • Read from the current leader after writing, provided its read path checks that it still leads.
  • Remember the last version seen and wait or reroute if another copy is behind.
  • Using one replica helps only while it stays available and does not lose already-observed progress.
  • Guarantees for one user’s reads can be combined; they are not a single ladder of stronger and weaker models.

Examples

Keep your edit visible

After an edit, the app routes that learner’s reads to the leader for ten seconds.

An edit saved as version twelve reaches the current leader, and subsequent reads require at least version twelve before showing the card.

Prove that the read includes the saved version.

An edit saved as version twelve reaches the current leader, and subsequent reads require at least version twelve before showing the card.

Ten seconds is a useful routing policy, not a proof that followers caught up. Afterward, require the saved version or keep routing safely.

The insight

Give users their own changes without relying on a fixed lag estimate.

Trade-offs

Pros

  • Match guarantees to user needs.
  • Avoid coordination where old data is acceptable.

Cons

  • Weaker models add application work.
  • Mixed guarantees take care to explain.

Use when

  • Money or inventory requires coordinated decisions.
  • User sessions must preserve observed progress.

Avoid when

  • Eventual consistency is chosen without examining visible behaviour.
  • Replica stickiness is treated as a guarantee through every failure.

Quick check

Your score goes from 3–2 back to 2–2 after a refresh. Which guarantee is missing?
Which model means copies will eventually match once updates stop?

Takeaways

  • Consistency models describe specific promises about reads and update order.
  • Read-your-writes and monotonic reads protect a user’s session.
  • Keep dependent updates in order and verify versions when switching copies.

Try the quick check above whenever you feel ready.

Previous: CAP Theorem & PACELC