A distributed system can only guarantee two out of three key properties: Consistency (all nodes see the same data), Availability (every request gets a response), and Partition Tolerance (the system works despite network failures)
In the context of CAP, a system is distributed if:
In a distributed system, you can only pick TWO.
If the network breaks, we stop talking to prevent "wrong" data.
If the network breaks, keep serving the user.
| CP (Consistency) | AP (Availability) |
|---|---|
| Banking: Prevent double-spending. | Social Media: Feeds can be slightly stale. |
| Distributed Locks: Only one master. | Shopping Carts: Never block "Add to Item". |
| K8s Scheduling: One source of truth. | Metrics/Logs: High-speed ingestion. |
CAP is a mental model for learning, not the final destination.
Based on our current stack, how do we think of CAP?