# Strong Consistency: Every Read Sees the Latest Confirmed Write

> Learn what strong consistency promises, what it costs in speed and uptime, and when a bank, a shop, or a ticket site should pay that cost.

**In short:** Strong consistency promises that every read sees the latest confirmed write, at a cost in speed and uptime that a bank, shop or ticket site may choose to pay.

From "System design", a free course by Venkat R. Murty: https://designervenkat.online/learn/system-design/strong-consistency

## What you will learn

Strong consistency is a promise about shared data. When a system says a change is saved, anyone who asks for that data next gets the new value. This lesson explains the promise, the price of keeping it, and the kinds of products that should pay that price. By the end, you should be able to say when strong consistency is worth it and when it is not.

Read these key words first. They come back again and again below.

- **Node:** One computer or one running program that holds data and answers requests.
- **Replica:** A copy of the same data, kept on another node.
- **Write:** A request that changes data, such as a new account balance.
- **Read:** A request that asks for data without changing it.
- **Confirm:** The system tells the caller that a write has succeeded.
- **Stale:** Old data that no longer matches the latest write.
- **Synchronous replication:** The main copy waits for other copies to save a change before it confirms success.
- **Network partition:** A break in the network that stops some nodes from reaching other nodes.
- **Latency:** The time from sending a request to getting the answer back.
- **CP system:** A system that stays consistent during a partition, even if it has to refuse some requests.

## Why do copies cause trouble?

Large products rarely keep one copy of important data. They keep several replicas so the service stays fast and keeps working when one machine fails. The catch is that a change made on one copy needs time to reach the others. For a short moment, two copies can disagree, and a reader might get the old one.

The rules that decide what a reader may see after a change are called a consistency model. Strong consistency is one of the strongest common models. It says that once a write is confirmed, every later read gets that value or something newer, no matter which copy answers. Researchers often use the word linearizability for the same idea, meaning that each operation appears to take effect at a single instant between its start and its finish.

- **Latest value:** A read returns the newest confirmed write. An older copy is not allowed to answer with old data.
- **Any copy:** It does not matter which replica receives the read. The answer is the same.
- **Confirm last:** The system says success only after the change is safe on enough copies.

## What is the guarantee in detail?

The guarantee has two halves. The first is about reads: after a write is confirmed, later reads from any replica must show it. The second is about writes: the system must not confirm success until the change is in place on the copies it depends on. The second half is what makes the first half possible.

Think of a single shared notebook. Everyone writes on the same page, so nobody can read an old line once someone has finished writing a new one. Strong consistency aims for that feeling, even when the data is spread across many machines.

Systems keep the promise in a few ways. One common method picks a single leader. The leader decides the order of changes, which stops two conflicting writes from both winning. Another method uses quorums, where each read and each write touches enough copies that the two groups must overlap.

The rest of this section looks at the most direct method, synchronous replication.

### What is synchronous replication?

In synchronous replication, the leader sends each change to its followers and waits for them to save it before it confirms success. A follower is a replica that copies changes from the leader. The opposite choice is asynchronous replication, where the leader confirms first and sends copies later. That is faster, but a reader on a copy may see old data for a while.

### How is one write confirmed?

Here is the order of events for one confirmed write when the leader waits for at least one follower.

1. **Client sends the write:** The app sends the change, such as a new balance, to the leader.
2. **Leader saves locally:** The leader records the change in its own storage.
3. **Followers get the change:** The leader sends the same change to each follower.
4. **Followers reply:** Each follower saves the change and sends back a reply.
5. **Leader confirms:** Only after the required replies arrive does the leader report success.

## What is the cost of strong consistency?

Strong consistency is not free. The price shows up as slower writes and, during a network split, as refused or delayed requests. Engineers call this a trade-off: you gain certainty, and you give up some speed or uptime in return.

## Slower writes

Every write must wait for copies to agree, and that wait adds latency. The delay grows when copies sit far apart.

Reads can cost time too. A quorum read has to check several copies before it can answer, so the system does more work than it would with one copy.

## Refusing requests during a split

A network partition can leave groups of nodes unable to reach each other. A strong system cannot let both groups keep answering as if nothing happened, because they may disagree about the latest value. Some of the nodes may simply stop making progress until the network heals.

Systems that choose consistency over availability in this situation are often called CP systems. The letters stand for consistency and partition tolerance. A CP system may refuse a request, or return an error, rather than risk giving a stale answer.

> **Tip:** CAP is a bigger topic with its own lesson. For now, remember one idea: a strong system prefers to say no, or to wait, rather than answer with old data.

## Worked example: a bank transfer

Here is a simplified picture of a banking app. The numbers are invented for teaching and do not describe any real bank. Your account holds $500. You transfer $100 to a friend and then open the balance screen right away. Bank balances must match the real money at all times, so the app needs strong consistency for them.

1. **Transfer request:** The app sends the $100 transfer to the leader copy of your account.
2. **Leader applies the change:** The leader lowers the balance to $400 and sends that change to a second replica.
3. **Second replica saves:** The second replica records the new balance $400 and replies to the leader.
4. **Success is shown:** Only after that reply does the app show that the transfer went through.
5. **Balance screen opens:** The screen asks a different replica for the balance. That replica already holds $400, so the screen shows $400.

Now picture the failure case. Suppose the balance screen is served by a replica that never received the change. Under strong consistency, the transfer could not have been confirmed while that copy was still out of date. So the screen cannot show the old $500 after the app has said success. Without that rule, the stale copy could show $500, and you could spend the same $100 again.

**Quick check:** A banking app moves $100 out of an account. One second later, the balance screen is served by a replica that has not yet received the change. Under strong consistency, what must be true?

A. The screen may show the old $500 for a while, because strong consistency only promises the final result.
B. The transfer should not have been confirmed until the copies could reflect it, so the screen cannot show the old balance after success.
C. The app should show $400 but let the user spend again if the network is slow.
D. The screen should show whichever copy answers fastest, since the money has already moved.

**Answer:** B. Strong consistency means a confirmed write must be visible to later reads. The system must wait until the change is safe on the copies it relies on, so an old balance cannot appear after success.

> **Tip:** Test any strong design with one question: after the app shows success, can any reader still see the old value? If the answer is yes, the design is not strong.

## When to choose it

Strong consistency is worth its cost when stale data causes real harm. Ask what a wrong answer would break. If the answer is money, stock, or a seat, the cost is usually worth paying. If the answer is a like counter on a photo, it often is not.

- **Bank balances:** Balances must match the real money. Otherwise, a person can spend the same funds twice.
- **Inventory counts:** Selling the last item to two buyers costs money and trust, so the count must be exact.
- **Seat booking:** Two people must never hold the same seat, so the booking must be decided in one agreed order.

### Where you will find it

Strong consistency is also common in relational databases, which follow ACID rules for transactions. ACID stands for atomic, consistent, isolated, and durable.

Some distributed systems also use consensus, where several nodes agree on one order of changes before they accept them. Products like these are where you will meet the trade-off in practice.

> **Tip:** Do not use strong consistency for everything. A common design mistake is to pay its cost on every feature, even where a short delay in seeing new data does no harm. Use it for payments and stock, and lighter rules for feeds and counters.

## Quiz: two buyers, one seat

Try a new situation. Use the ideas from this lesson to answer it.

**Quick check:** A concert ticket site runs two servers. Two people try to buy the last seat at the same moment, and each one reaches a different server. The servers briefly cannot talk to each other. Should the site use strong consistency, and what should happen to the second buyer's request?

A. No. Let both buyers get a seat, and fix any double booking later with refunds.
B. Yes. The second request is refused, or waits until the servers can agree, so the seat is never sold twice.
C. Yes. The second request goes to the server that has not heard about the first sale, so it succeeds.
D. No. Each server should sell from its own list, because that is faster and keeps the site online.

**Answer:** B. Selling one seat twice is the kind of harm strong consistency prevents. During a split, a strong system refuses or delays the request rather than answer from a server that may be out of date.

## A small code model

The code below is a toy. It has no network and no failures. It shows only one rule: the leader updates the copies before it reports success.

```python
class Replica:
    def __init__(self, name, balance):
        self.name = name
        self.balance = balance

def write_synchronously(leader, copies, new_balance):
    leader.balance = new_balance
    for copy in copies:
        copy.balance = new_balance
    return 'confirmed'

a = Replica('A', 500)
b = Replica('B', 500)
result = write_synchronously(a, [b], 400)
print(result)
print('A shows', a.balance)
print('B shows', b.balance)

```

Output:

```text
confirmed
A shows 400
B shows 400

```

Because the function returns only after every copy is updated, any reader that checks copy B after the confirmation sees 400. Real systems must also handle crashes and slow links, and that is where the hard work lies.

## Key points to remember

- **The promise:** After a write is confirmed, every later read from any replica returns that value or something newer.
- **The price:** Writes wait longer, and during a network split the system may refuse or delay requests.
- **The choice:** Pick strong consistency where stale data causes real harm, such as money, stock, and seats. Use lighter rules elsewhere.

## Sources

- [AlgoMaster: Strong vs Eventual Consistency (lesson page)](https://algomaster.io/learn/system-design/strong-vs-eventual-consistency)
- [AlgoMaster blog: Strong vs. Eventual Consistency](https://blog.algomaster.io/p/strong-vs-eventual-consistency)
- [Jepsen: Linearizability](https://jepsen.io/consistency/models/linearizable)
- [ITU Online: What Is Linearizability? Meaning and Examples](https://www.ituonline.com/tech-definitions/what-is-linearizability/)
- [Design Gurus newsletter: Distributed Systems Fundamentals (Week 2)](https://designgurus.substack.com/p/week-2-distributed-systems-fundamentals)
- [Design Gurus blog: System Design Fundamentals, Eventual vs Strong Consistency](https://www.designgurus.io/blog/eventual-vs-strong-consistency)
- [System Design Sandbox: Consistency Patterns](https://www.systemdesignsandbox.com/learn/consistency-patterns)
- [ScaleEngineer: Strong vs Eventual Consistency in Distributed Systems](https://scaleengineer.com/blog/what-is-strong-vs-eventual-consistency)
- [TechInterview: CAP Theorem: Consistency, Availability, and Partition Tolerance](https://www.techinterview.org/post/3233459954/cap-theorem/)
- [arXiv 1103.2408: Using Paxos to Build a Scalable, Consistent, and Highly Available Datastore](https://arxiv.org/pdf/1103.2408)
- [arXiv 1212.1046: Latency Bounding by Trading off Consistency in NoSQL Store](https://arxiv.org/pdf/1212.1046)
- [arXiv 1707.01747: Verifying Strong Eventual Consistency in Distributed Systems](https://arxiv.org/pdf/1707.01747)
- [Medium: Replication in Distributed Systems: Beyond Just Copying Data](https://abhilodha.medium.com/replication-in-distributed-systems-beyond-just-copying-data-90555ff5bc6f)
- [DEV Community: Consistency vs. Eventual Consistency in Microservices](https://dev.to/isaactony/consistency-vs-eventual-consistency-in-microservices-21pe)
