Boss lesson · Unit 02
Pick two, sort of
What a partition forces you to give up
What you practise
- A partition forces a choice between answering and being right
- CP and AP systems by example
- Consistency models from linearizable to eventual
- PACELC: latency is the everyday trade
Try a question from this lesson
Pick one
One replica is in Paris, one in Tokyo. The link between them is cut, but each still reaches local users. Tokyo accepts x = 2. A Paris user reads x. What can Paris do?
Correct answer
Answer with a possibly stale x, or refuse to answer
Why
Paris cannot know about a write it cannot hear of. It can answer with what it has, which may be wrong, or refuse until the link is back. There is no third option, and that is the whole CAP theorem.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
CAP, stated properly
When a network partition splits a system, each side must choose.
Stay available: keep answering with what you have, and risk stale or conflicting data. Or stay consistent: refuse requests you cannot answer correctly.
Partitions are not optional, since cables and switches fail. So the real choice is C or A, and only while a partition lasts.
partition
[ Paris ] X [ Tokyo ]
| |
answer stale? took x = 2
or refuse?Concept
A scale of consistency
Consistency is not one thing. Strongest is linearizable: the system acts like a single copy, and every read sees the latest completed write.
Weakest is eventual: replicas may disagree for a while, but converge once writes stop.
In between sit promises you have met, such as read-your-writes and monotonic reads. Stronger costs latency and availability.
9 more exercises in the app
- 4× multiple choice
- 1× true or false
- 1× order the lines
- 1× type the answer
- 1× fill the blanks
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.