CAP theorem (and PACELC)
When the network splits a distributed database, it must choose between answering every request and always returning the latest data.
CAP stands for consistency, availability and partition tolerance; since partitions happen anyway, the real choice during one is consistency or availability. PACELC adds the everyday case: else, when the network is fine, you trade latency against consistency, for example by waiting for replicas in other regions. It explains why a database marketed as fast and globally distributed reads stale data by default somewhere.
Related terms
- Eventual consistency: A guarantee that copies of data will agree once updates stop arriving, but may briefly show different values in the meantime.
- Split-brain: Two parts of a system both believe they hold the truth and accept changes independently, so their data drifts apart.
- Two-phase commit (2PC): A protocol where a coordinator asks every database to prepare a change, then tells all of them to commit or all of them to roll back.
