# Weak Consistency: Why Readers May See Old or Missing Data

> Learn why some systems accept stale or missing data in return for speed and availability, and which products can live with that trade.

**In short:** Weak consistency means a system accepts stale or missing data in return for speed and availability, which suits products that can live with that trade.

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

## What you will learn

This lesson explains weak consistency, one of the rules a system uses to decide what readers may see after someone saves new data. By the end you should be able to say what weak consistency promises (very little), why engineers choose it on purpose, and which products can accept it and which cannot. You will also see a worked example, a short code sample, and a quiz.

- **Consistency:** How closely the copies of some data agree with each other, and what readers are allowed to see.
- **Write:** Saving a new value, such as a new score, a new message, or a new stock count.
- **Read:** Asking the system for a value that is already stored.
- **Replica:** An extra copy of the same data, kept on another server or device.
- **Stale data:** An old value that has been replaced by a newer one but is still being returned.
- **Availability:** How often a service is able to answer requests when someone asks.
- **Latency:** The time one request takes from the moment it is sent to the moment the answer arrives.
- **Best effort:** The system tries to deliver an update, but it does not promise that the update will arrive.

## What does weak consistency mean?

Imagine a social app that keeps three copies of your profile on three different servers. You change your display name. The app says the save worked. A friend then loads your profile, and the request lands on a server that has not received the change yet. Under weak consistency, the friend may see your old name. The system does not say when the friend will see the new name, and it does not say that the friend will see it at all.

Engineers describe this behavior with a simple rule: after a write, reads may or may not see it. The system sends the new value out as well as it can, but it does not wait to confirm that every copy has it. That is why the approach is called best effort. After a write, reads may or may not see it. The primer that describes this pattern adds that a best effort approach is taken.

Weak consistency is a model, which means it is a set of promises about what readers can see. Here the set of promises is almost empty. The system promises to try, and nothing more.

1. **A write is accepted:** The system saves the new value on the server that received it and reports success to the sender.
2. **Copies may lag:** Other copies do not have to be updated before the next read. Some may never receive the change.
3. **A read may return old data:** A reader that asks a lagging copy gets the old value, and the system does not treat that as an error.

The key idea is that a successful write does not mean every later reader will see it.

1. **Strong consistency:** Every read after a successful write returns the newest value, so readers never see the old one.

### How does it contrast with strong consistency?

The opposite model is strong consistency. Strong consistency means reads behave as if there is one correct copy of the data. In plain words, a reader who asks after a write has finished always gets the newest value, no matter which copy answers the question.

Strong consistency is harder to build. The system has to coordinate its copies before it can confirm a write, and that coordination takes time. The two models sit at opposite ends of one scale: strong consistency promises the most, and weak consistency promises the least. Strong consistency provides the highest level of data consistency but may come at the cost of increased latency and coordination overhead.

> **Tip:** Ask whether a stale reader would cause harm. If the answer is no, weak consistency may be worth considering. If the answer is yes, a stronger model is safer.

## Why do systems accept this?

- **Less waiting on writes:** A system that does not guarantee ordering does not need a step that keeps all copies in lockstep. Weak consistency does not provide ordering guarantees, so no synchronization protocol is actually required. Skipping that step lets writes finish sooner.
- **Staying up during network trouble:** When the link between servers breaks, a system that insists on matching copies may have to refuse requests. A weakly consistent system can keep answering with the copy it has. The system can continue operating even if some nodes are out of sync or unavailable.
- **Quicker replies:** Reads and writes that never wait for other machines finish faster. The system can respond faster by prioritizing availability over synchronization.

> **Tip:** Weak consistency is not a bug. It is a choice. The design gives up freshness on purpose, so that speed and availability stay high.

## What is the trade-off?

The benefits come with a price. Because copies can disagree, a reader may see stale data, or may never see a write at all. Some sources also list conflicts, where two writes to the same item clash and the system has to pick one. The disadvantages of weak consistency include potential data loss, data inconsistency, and data conflicts.

So the trade is simple to state. The system can be fast and available, but it may show old or missing data. Whether that is acceptable depends entirely on the product and on what a missed update costs the people using it.

## Where does weak consistency fit?

Weak consistency works best when losing or delaying a little data is harmless. Real-time products are the usual examples, because the moment has already passed by the time a late update would arrive.

### Good fits: loss-tolerant, real-time uses

- **Video calls:** Weak consistency works well in real time use cases such as VoIP, video chat, and realtime multiplayer games. A call that skips a few seconds still works, because the next moment matters more than the missed one.
- **Live streaming:** A viewer's stream keeps moving when packets are lost. Lost video frames due to poor network connectivity are not retransmitted in a live stream.
- **Multiplayer games:** Player actions can be reflected with some delay, as the system doesn't need perfect consistency. A small update that arrives late is tolerable, and the game moves on.
- **Memcached-style caches:** Caches such as Memcached often follow this model. A cached copy can be slightly old, and for many reads that is acceptable.

### Poor fits: data that must be right

Bank balances and inventory counts are poor matches. If a bank app shows an old balance, a customer might spend money that is already gone. If a store shows an item as available after it sold out, the store may sell the same item twice. A missed update here is not a small blur. It is a real loss.

The general rule is simple. Use strong consistency where stale data can break correctness. Money, stock, permissions, and locks all fall into that group.

## Worked example: a video call drops for a few seconds

Here is one real product, a video call app, walked through step by step. Ana and Ben are talking, and the app sends their audio and video through its servers.

1. **The call is live:** Ana hears Ben and sees him on her screen. Both sides are showing the current moment.
2. **The network stutters:** Ben's connection drops for a few seconds. The pieces of audio and video that were sent during that gap never reach Ana.
3. **The connection returns:** The app reconnects. When the connection is regained, the listener does not hear what was spoken during the connection loss.
4. **The call carries on:** Ana's screen jumps to the present moment. The app does not replay the gap, and it does not hold the call back to fill it in.
5. **The result:** The lost seconds are gone for good. The call stayed fast and live, which is the goal, but the missed part is not recovered. It is the same trade-off weak consistency makes: speed first, and a missed update stays missed.

> **Tip:** Notice what the app did not do. It did not pause the call until every piece was delivered. That pause would have made the call feel broken, which is why real-time apps accept the gap.

## Code sample: a read that comes too early

The sample below uses two dictionaries to stand in for two copies of one value. The write lands on the first copy. A read from the second copy shows the old value, because the change has not been passed on yet. The last line passes it on.

```python
primary = {'score': 0}
replica = {'score': 0}

primary['score'] = 5
print('primary:', primary['score'])
print('replica:', replica['score'])

replica['score'] = primary['score']
print('replica after sync:', replica['score'])
```

Output:

```text
primary: 5
replica: 0
replica after sync: 5

```

The printed 0 is stale data. Under weak consistency, a reader who asks the replica at that moment gets the old value, and nothing in the system promises that the replica will be updated in time.

## Eventual consistency: a stronger cousin

Eventual consistency is the next model up from weak consistency, and it is often confused with it. Both allow stale reads for a while. The difference is what happens later. Eventual consistency is a slightly stronger notion than weak consistency. Under eventual consistency, replicas converge towards identical copies in the absence of further updates.

In short, weak consistency makes no promise about the end state, while eventual consistency promises that copies will agree once updates stop. How that agreement is reached is covered in the Eventual Consistency lesson. Strong consistency and its costs are covered in the Strong Consistency lesson. The link between these choices and the CAP theorem gets its own lesson too.

## Check your understanding

**Quick check:** A live-streaming app drops a few video frames when a viewer's network stutters, then continues with the current frame. Is this weak or strong consistency, and why is it acceptable here but not for a bank transfer?

A. Strong consistency, because the app waits for every frame before it moves on
B. Weak consistency, because lost frames are tolerable in a live stream and the viewer is moved to the present
C. Eventual consistency, because the missing frames will be filled in once the network recovers
D. Strong consistency, because the viewer must always see every frame of the stream

**Answer:** B. The app accepts a gap and does not try to recover it, so no promise about what every reader sees is being kept. That is weak consistency. A missed frame is gone in a second, so the cost is small. A bank transfer cannot skip a step, because a lost or stale record could move money twice or not at all.

**Quick check:** A shop app shows a count of how many pairs of a shoe are left. A customer buys the last pair. Another shopper then loads the page and still sees one pair. Which model should the stock count use?

A. Weak consistency, since a brief stale count rarely matters to shoppers
B. Strong consistency, since a reader must not act on an old count
C. Weak consistency, since the same app also runs a live video feature
D. No consistency model, since stock counts do not need to be shared

**Answer:** B. A stale stock count can lead to a sale that the shop cannot fill. That is a real harm, so the count needs the newest value on every read. Weak consistency fits live video, where a missed moment is simply gone, but it is a poor fit for stock.

## Key takeaways

- **The promise:** After a write, a later read may or may not see the new value, and the system does not say when or whether it will.
- **The benefit:** Skipping synchronization keeps writes and reads fast and keeps the service up during network problems.
- **The cost:** Readers may see stale or missing data, so the model must fit a product where a small gap is harmless.

## Sources

- [System Design Primer: Consistency patterns (GitHub)](https://github.com/donnemartin/system-design-primer/blob/master/README.md)
- [Consistency Patterns - System Design](https://systemdesign.one/consistency-patterns/)
- [Weak Consistency in Distributed Systems (layrs)](https://layrs.me/course/hld/02-core-concepts/weak-consistency/)
- [Navigating Consistency in Distributed Systems (Hazelcast)](https://hazelcast.com/blog/navigating-consistency-in-distributed-systems-choosing-the-right-trade-offs/)
- [Consistency in Non-Transactional Distributed Storage Systems (arXiv 1512.00168)](https://arxiv.org/pdf/1512.00168)
- [Strong vs Eventual Consistency (AlgoMaster)](https://algomaster.io/learn/system-design/strong-vs-eventual-consistency)
- [Understanding Consistency Models in Distributed Systems (Medium)](https://medium.com/@rockengineering/understanding-consistency-models-in-distributed-systems-2e098544290a)
- [What are Consistency Models? (ScyllaDB glossary)](https://www.scylladb.com/glossary/consistency-models/)
- [Idea of Consistency patterns in System Design (OpenGenus IQ)](https://iq.opengenus.org/consistency-patterns-in-system-design/)
- [Day 19: Consistency and Availability Patterns (Medium)](https://medium.com/@shivanimutke2501/consistency-availability-patterns-in-distributed-systems-79c21c4e2f6c)
