The whole course ▾

System Design · Lesson 14 of 39 · Week 3

CAP, consistency and quorums

Updated 22 Oct 2026 · By Akshay, software engineer, India · 5 min read

Two copies of QuickBite's data disagree: one says the order is delivered, one says it isn't. Which do you believe? Today: consistency.

Got a doubt? Ask in the comments under the video.Subscribe

QuickBite in this lesson

QuickBite's order status versus its restaurant ratings.

QuickBite is the food delivery app we grow through the course, from one server to millions of orders.

When copies disagree

When copies disagree
Rider app
Replica
says: delivered
Replica
says: on the way
Customer
mark delivered
1
copy, soon
2
status?
3
stale for 300 ms

This week QuickBite got copies everywhere: followers, shards with their own replicas, keys copied around a ring. Copies keep us fast and alive. Until two of them disagree.

The rider app marks an order delivered, and that write lands on one replica. A moment later, the customer checks the status, and the read lands on another replica, which hasn't heard yet. It says: on the way. For a few hundred milliseconds, the two copies disagree, and two people see two different truths about the same order.

Is that a bug? For an order status, a little stale is mostly harmless: the customer refreshes, and it's right. Now imagine the same thing with a payment: one copy says paid, another says not paid, and a second charge goes through. The question this lesson answers is when a stale read is fine, when it isn't, and what it costs to prevent.

Strong or eventual

Strong or eventual
Eventual consistency
A read may be a moment old
Two readers can see different answers
Wrong for money
Strong consistency
Every read sees the latest write
Everyone sees the same answer
Right for money and orders
SO WHICH?
Strongwhereastaleread
costsmoney;eventualfor
likes,ratingsandview
counts.

There are two promises a system can make about its copies, and they have names.

Eventual consistency promises: if writes stop, every copy will agree soon, but a read right now may return old data. Strong consistency promises: every read sees the latest write, as if there were only one copy. Strong sounds strictly better. The catch is the cost. To keep that promise, copies must check with each other before answering, which means waiting, and, as you'll see next, sometimes not answering at all.

So which one? It depends on the harm of a stale read. If a restaurant's rating is a few seconds old, nobody is hurt, so eventual is fine and much cheaper. If a payment's state is a few seconds old, someone can be charged twice, so it has to be strong. Most real systems use both, feature by feature.

What CAP really says

What CAP really says
Customer
Server 1
Server 2
Restaurant
write
1
sync
read
2
can't reach server 1
During a partition
1
Consistent: refuse, or wait
2
Available: answer, maybe stale
CAP, PRECISELY
Whenthenetworksplits,
eachcopymustchoose:
refuse(consistent)or
answerstale(available).

That cost has a famous name, the CAP theorem. It's usually explained badly, so here's the precise version.

CAP is about one situation: a network partition. The link between two copies breaks, but both are still running and still getting requests. A customer writes to the first server. A restaurant reads from the second, which can no longer reach the first, so it doesn't know about that write. Server two now has exactly two choices, and CAP says there's no third.

Choice one, stay consistent: server two refuses to answer, or waits, because it can't be sure it has the latest data. Choice two, stay available: it answers with what it has, which might be stale. That's all CAP says. While the network is healthy, you can have both. Networks do break, so the real design question is what each feature does when they do.

So when someone says pick two out of three, gently correct it. Partitions aren't optional; they happen. The choice is consistency or availability during a partition, and it can be different for every feature of the same app.

Quorums: N, R and W

Quorums: N, R and W
App server
Copy
version 7
Copy
version 7
Copy
version 6: missed it
write v
write v
too slow
N=3 W=2
The quorum rule
N = 3 copies
W = 2 confirm each write
R = 2 answer each read
R + W > N -> reads see the latest
TURN THE DIAL
R+W>N:readssee
thelatest.R=W=1:
fastest,buteventually
consistent.

Many databases let you set exactly where you stand between the two, with three numbers.

Keep N copies of each piece of data, say three. A write from the app server goes to all three, but counts as done once W of them confirm, say two. Here, the third copy was slow and missed it, so it still holds version six. A read asks R copies, say two, and takes the newest version among the answers.

Here's why that works. Three copies. Every write reaches at least two. Every read asks at least two. Two plus two is four, more than three, so any two copies you read must include at least one that took the latest write. The groups always overlap. That's a quorum: if R plus W is greater than N, a read sees the latest successful write.

And you can turn the dial. Write to all three and read from one, and reads are fast, but one dead copy blocks every write. Read one and write one, and it's the fastest of all, but only eventually consistent. Cassandra lets you choose this on every single request, and DynamoDB lets you ask for a strongly consistent read when you need one.

A payment versus a like

A payment versus a like
QuickBite, feature by feature
->
Payments: strong; refuse if unsure
->
Your order's status: read your own writes
->
Ratings and reviews: eventual
->
Likes and view counts: eventual
THE QUESTION TO ASK
What'stheharmif
someoneseesdataafew
secondsold?

So how does QuickBite decide? Feature by feature, by asking what a stale read would cost.

Payments: strong, and if the system can't be sure, it refuses and asks the customer to try again. A refused payment is annoying; a double charge is a disaster. Your own order's status: read your own writes, from lesson eleven. Restaurant ratings and reviews: eventual, nobody minds a few seconds. Likes and view counts: eventual, and they can even be approximate.

One question decides it every time: what's the harm if someone sees data a few seconds old? Real harm means strong consistency, paid for with waiting and occasional refusals. No harm means eventual consistency, and a faster, more available system.

In the interview

In the interview
SAY THIS IN THE INTERVIEW
Strongwheremoneymoves,
eventualwhereitdoesn't;
quorumswithR+W>N
whereyouneedboth.
Follow-ups to expect
->
What does CAP actually say?
->
How does a quorum work?
->
What if a copy is down?
THE COMMON MISTAKE
"Picktwoofthree."
Partitionsaren'toptional:
thechoiceisCorAwhen
thenetworkbreaks.

Interviewers love this topic, because it shows whether you understand trade-offs or just repeat slogans.

Say it per feature: strong consistency where money moves, eventual where it doesn't, and quorum reads and writes, with R plus W greater than N, where you need correctness without a single leader. Then name one feature of each kind in the system you're designing.

Then expect these. What does CAP actually say? During a partition, choose consistency or availability. How does a quorum work? R plus W greater than N, so read and write groups overlap. And what if a copy is down? With three copies and two needed, one can be down and everything keeps working; that's the point of quorums.

The common mistake is the slogan: pick two out of three. You can't opt out of network failures, so the real choice is consistency or availability while one is happening. Say it that way, and you sound like someone who has run a real system.

Quick check

Quick check
?
N = 3, W = 2, R = 1. Does
every read see the latest
write?
No: R + W = 3, not more than N.
The one copy you read may have
missed it.
?
The network splits. A payment
service can't reach its other
copy. Answer or refuse?
Refuse, or wait: for money,
consistency beats availability.
Remember
Strong: every read sees the
latest
CAP: in a partition, C or A
Quorums: R + W > N
Quick check

N = 3, W = 2, R = 1. Does every read see the latest write?

Show the answer

No: R + W = 3, not more than N. The one copy you read may have missed it.

Quick check

The network splits. A payment service can't reach its other copy. Answer or refuse?

Show the answer

Refuse, or wait: for money, consistency beats availability.

Remember: strong consistency means every read sees the latest write, and it costs waiting. CAP says that during a partition, you choose consistency or availability. And quorums overlap when R plus W is greater than N. That's the whole data week: indexes, replication, sharding, consistent hashing, and now consistency.

Practise with flashcardsYour progress stays on this device.
New System Design videos at 6 pm

Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.