esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Consistency Patterns: Weak, Eventual, and Strong Consistency Explained

When data lives on several computers, the copies can disagree for a moment. Learn the three consistency patterns, what each promises, and how to pick one.

In short

When data lives on several computers, the copies can briefly disagree, and the three consistency patterns, weak, eventual and strong, set what each system promises.

9 min readFree

Start Here: Why Copies Must Agree

When a product stores its data on more than one computer, the copies can fall out of step for a short time. A consistency pattern is the promise a system makes about what a reader sees after someone writes new data. This lesson explains the three main promises, what each one costs, and how a designer picks one. By the end, you should be able to match a product feature to the right pattern and explain why.

Earlier lessons looked at speed and scale. This one asks a new question: when two copies of the same data disagree, which value should the user see, and how sure must that answer be?

Key words

Node
One computer or server in a system that stores data or does work.
Replica
An extra copy of the same data, kept on another node.
Write
An action that changes data, such as adding a like or changing a bank balance.
Read
An action that asks for data so it can be shown to a user.
Stale data
An old value that is no longer the newest one.
Consistency pattern
The promise a system makes about whether readers see the latest write.
Availability
Whether the system still answers requests, even when some parts fail.
Acknowledge
To tell the sender that a write was accepted and saved.

Why can copies disagree?

Systems copy data to several nodes for two main reasons. If one node fails, another still has the data. The cost of this design is that a new write must travel to every copy, and that trip takes time.

  • One write, many copies

    The new value has to reach each replica. Each trip can take a different amount of time.

  • Readers can get different answers

    Two people who ask two copies at the same moment may see two different values.

  • A product decision

    A designer must decide whether the product can tolerate that gap, and how long it may last. That decision is the consistency choice.

The three patterns are points on a range. At one end, the system promises very little. At the other end, it promises that every read sees the newest write. The sections below walk along that range from loosest to strictest.

What is the moment of disagreement?

Suppose a write reaches copy A first. Copy B has not received it yet. For a short moment, a reader who asks copy B gets the old value. Nothing has crashed. The system is simply still copying. Whether that moment matters depends on what the data is used for.

What are the three consistency patterns?

Each pattern makes a different promise about what a read will return after a write. Some sources describe them as a spectrum, from weak to eventual to strong. Moving toward strong gives more up-to-date data, and it usually costs more speed or availability.

What is weak consistency?

With weak consistency, the system makes very few promises. After a write, a read may or may not see it. Updates may be delayed, and copies can be inconsistent for a while. This is often called best effort. Designers pick it when speed and availability matter most. Some real-time multiplayer games fit this pattern, because a player's action may show up a moment late without spoiling the game.

What is eventual consistency?

Eventual consistency promises more than weak. Copies may disagree for a while, but if no new writes arrive, they all reach the same value. A reader who gets stale data can ask again a moment later and see the newer value. The gap is often short. Many NoSQL databases use this as their default, because it keeps reads fast and the system responsive.

Strong Consistency

Strong consistency promises that once a write succeeds, every later read returns that new value, no matter which copy answers. To keep this promise, the system waits until the write is safely on the copies before it tells the sender the job is done. That waiting is the price of the promise.

How a Strong Write Works

  1. 1

    Write reaches the main copy

    One copy takes the write first. Call it the main copy.

  2. 2

    Main copy sends the change

    The main copy passes the new value to the other replicas.

  3. 3

    Replicas confirm

    Each replica saves the value and reports back.

  4. 4

    Sender gets the answer

    Only after the copies agree does the system acknowledge the write to the user.

  5. 5

    Every read agrees

    Any later read, from any copy, returns the new value. The cost is extra waiting, and a write can stall if a replica cannot be reached.

How to Choose the Right Pattern

The key question is simple: what harm happens if a reader sees old data? If the harm is lost money, an item sold twice, or a seat booked twice, choose strong consistency. If the harm is a number that is a little behind, eventual or weak consistency is usually enough. You choose based on the data and the product, not on which pattern sounds most advanced.

Tip

Choose a pattern for each type of data, not for the whole system. One application can use strong consistency for payments and eventual consistency for its activity feed.

When Strong Is Worth the Cost

  • Money balances

    A wrong balance can lead to a payment that should have been refused.

  • Scarce stock and seats

    If two buyers can both claim the last item, the business has promised something it cannot deliver.

  • Bookings and permissions

    An old permission can let someone act after access was removed.

When Slightly Stale Data Is Fine

  • Likes and view counts

    A count that is off by a few for a few seconds harms no one.

  • Feeds and comments

    A new post can appear a little late without any real loss.

  • Product descriptions

    A catalog change can take a moment to show, as long as the price at checkout is checked correctly.

The Trade-Off in Plain Words

Strong consistency makes the application easier to reason about, but it needs coordination between copies. That coordination adds delay and can reduce availability during failures. Eventual consistency improves availability and speed, but it allows copies to disagree for a while. Weak consistency gives the most speed and the fewest promises.

Worked Example: A Like Count and a Bank Transfer

Here is a walk-through with two features from one app. The photo app case is an illustration of how such an app could behave. It is not a description of how any real company builds its system. The bank case follows the same idea with money.

The Like Count (Eventual)

  1. 1

    A friend likes a photo

    The new like is written to one copy of the count.

  2. 2

    Your phone reads another copy

    That copy has not received the change yet, so your screen shows one fewer like.

  3. 3

    The copies catch up

    A few seconds later, the copies match, and your screen shows the new count.

  4. 4

    Nothing breaks

    The gap is small, and no decision depends on the exact number. Eventual consistency fits this data.

The Bank Transfer (Strong)

  1. 1

    You send money

    The transfer is one write. It must be saved before the app says it succeeded.

  2. 2

    The new balances are saved

    The bank records the change on the main copy and on the replicas.

  3. 3

    The app waits for agreement

    The app confirms the transfer only after the copies have agreed.

  4. 4

    Every screen shows the same balance

    Your phone, your laptop, and the bank's own systems show the new amount right away. A stale balance could let the same money be spent twice, so strong consistency is the right fit.

Why the Two Patterns Differ

The two features use different patterns in the same app. The design choice follows the harm. A few seconds of a wrong like count is harmless, but a wrong balance is not.

See a Stale Read in Code

The sample below is a toy model, not a real database. It keeps two copies in a dictionary. It shows that a read from the lagging copy can return the old value until the change is copied.

Python
primary = {'seats': 'free'}
replica = {'seats': 'free'}
primary['seats'] = 'booked'
print('primary:', primary['seats'])
print('replica:', replica['seats'])
replica['seats'] = 'booked'
print('replica after copy:', replica['seats'])

Output

primary: booked
replica: free
replica after copy: booked

The output shows the gap. After the write, the main copy has the new value while the replica still has the old one. Once the replica is updated, both agree. Strong consistency aims to make sure readers never land in the middle state.

Quick Check

Try these two scenarios. Each one needs the idea from this lesson, not just a memory of the definitions.

Quick check

A ticketing site keeps a copy of its seat map on two servers. Two people try to buy the last seat at the same moment. Which choice fits the seat booking, and which fits the counter that shows how many people are viewing the event?

Quick check

A music app shows how many times each song has been played. A gift card feature lets a customer spend the card balance. Which pairing is the best fit?

Key Takeaways

  • Copies create the question

    Once data lives on several nodes, a write takes time to reach every copy, so readers can briefly see different values.

  • Three promises

    Weak makes few promises, eventual promises that copies converge when writes stop, and strong promises that every read sees the latest successful write.

  • Pick by harm

    Use strong consistency where stale data causes real damage, such as balances, stock, and bookings. Use weak or eventual consistency for counts and feeds where a small delay is acceptable.

  • Pick per data type

    A single product often mixes patterns, so decide for each kind of data and each operation.

Sources

How is this lesson?

Last updated on 17 November 2026

Learn with me

Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.