The CAP theorem
KataTube gave up availability. Could a better store keep both? Suppose one promised it: consistent and available, whatever the network does. Give it two data centres, and cut the link.
Alice asks the EU side for @nova. An available store must answer, and the handle is free: “ok, it's yours”. Her change is confirmed, and it cannot reach the US side.
Then Bob asks the US side for @nova. That side never heard of Alice's channel. It has the same two moves as before:
- Answer “ok, it's yours”. A confirmed change is missing from the answer, and
@novahas two owners. Not consistent. - Refuse, or wait. Refusing is an error. Waiting helps only if the cut ends; the US side cannot tell a cut that ends from one that never does. Not available.
Either way a promise is broken, so no such store exists. That is the CAP theorem: if the network may lose every message between two groups of servers, for as long as it likes, no store that keeps copies in both groups can be both consistent and available.
If the network may lose every message between two sides for as long as it likes, no store can stay both consistent and available.