16. Consistency and CAP
16.5 What is a network partition?
CAP and beyond
At the bank: The phone line between the counters is cut. Each counter is fine, customers are still coming in, but they can't reach each other. Worse: from counter 2's side, "the line is cut" and "counter 1 is just slow to pick up" look exactly the same.
In the system: A network partition is when some machines can't communicate with others, even though each is still running. Causes: a failed switch or cable, a misconfigured firewall, a cloud provider's network problem between zones or regions, or a machine so overloaded it can't respond in time.
The key insight is that you can't tell a slow node from a dead one or an unreachable one. A request that hasn't been answered after 2 seconds might arrive in 3 seconds, or never. That's why systems use timeouts and must decide what to do when one fires.
Partitions are not optional. Any system with more than one machine talking over a network will, sooner or later, have messages lost or delayed. You don't get to choose whether partitions happen, only how your system behaves when they do.
Memory code: "A cut line and a slow line look the same from your side."