What is consistency?
Consistency is the answer to one question: when data has copies, do they all tell the same story at the same moment? Strong consistency means yes — every read, from any copy, returns the latest write, always. Eventual consistency means the copies converge, but for a window (milliseconds to seconds) a read may return a slightly older truth.
This is not an exotic edge case — you CREATED it in the replication lesson. The moment SliceNow added replicas that lag 50-500ms behind the primary, some reads started returning the recent past. Every system with copies of data lives somewhere on this dial.
The professional move is not "make everything strong" — you will see why that costs dearly — but knowing, per piece of data, how much staleness is harmless. A menu photo being 30 seconds behind: nobody notices. A payment balance being 30 seconds behind: money gets spent twice.
- strong consistency
- — every read sees the latest write, from any copy
- eventual consistency
- — copies converge; brief reads of the recent past are possible
- read-your-writes
- — a user always sees at least their OWN latest changes
Words to know
The vanishing address
A SliceNow customer moves apartments. They open settings, type the new address, hit save — the write lands on the primary. The app instantly navigates to the confirmation page, which re-reads their profile… from a replica that is 300ms behind. The page cheerfully shows the OLD address.
The customer, reasonably, concludes the save failed. They save again. Support tickets bloom. Nothing actually broke — the write succeeded on the first try — but the system read the recent past at the worst possible moment: right after the user changed the future.
The standard fix is small and surgical: read-your-writes routing. After a user writes, serve THAT USER's reads from the primary for a few seconds (or remember their write and wait for the replica to catch up). Everyone else can keep reading replicas — the customer in Sydney does not care that this stranger's address is 300ms stale. You bought correctness where it matters without giving up the replicas.
Replication lag
50–500 ms
Time to re-read
~100 ms (faster!)
Writes that failed
zero
Quick check
Which change fixes the vanishing-address bug with the LEAST cost?
CAP without the theory pain
Now the famous one. SliceNow runs its database in two datacenters, coasts apart, each with a full copy. One day the network link between them fails — both sides are alive, but they cannot see each other. This is a partition, the P in CAP. A customer in the East updates their address; a copy in the West cannot hear about it. Then someone asks the West side to read that address. What should it do?
There are only two honest answers. Refuse ("I can't promise this is current — try again later"): you protected consistency and sacrificed availability. Answer anyway with possibly-stale data: you stayed available and sacrificed consistency. That is the entire theorem: while a partition lasts, each piece of data picks C or A. Not a technology choice — a logical corner with no third door.
Real systems choose per data type. Bank withdrawals pick C (an ATM saying "temporarily unavailable" beats letting two cities empty the same account). Shopping carts, likes and menus pick A (showing a slightly stale cart beats refusing to sell pizza). When the link heals, the copies reconcile — that is the "eventually".
Common trap — The trap: demanding strong everywhere
"Just make it all strongly consistent" sounds safe and costs everything: every write must be confirmed by every copy before returning (slow writes, and one dead replica blocks ALL writes), caches become forbidden, and cross-region reads crawl at speed-of-light round trips. The interview-grade answer names which few pieces of data genuinely need strong consistency, gives everything else eventual — and says the staleness window out loud: "menus may be up to a minute stale, and that is fine."
Quick check
During a partition between two datacenters, SliceNow must decide how each side handles GIFT-CARD BALANCE spending. Which choice is right, and why?
Match them up
Match each term to its plain meaning.
0/5 matched — tap a term on the left.
Apply it in an interview
The URL shortener's multi-region question is secretly a consistency question: can a new link tolerate seconds of propagation delay? Decide, defend it, and say the staleness window out loud.