CAP Theorem
ELI5 — The Vibe Check
The CAP theorem says a distributed database can only guarantee two out of three things: Consistency (everyone sees the same data), Availability (every request gets a response), and Partition tolerance (it works even when network connections break). Since networks always break, you're really choosing between C and A. Pick your pain.
Real Talk
The CAP theorem (Brewer's theorem) states that a distributed system can provide at most two of three guarantees simultaneously: Consistency (all nodes see the same data), Availability (every request receives a response), and Partition Tolerance (the system operates despite network failures). Since partitions are inevitable, practical systems choose between CP (consistent but may refuse requests) and AP (available but may return stale data).
When You'll Hear This
"CAP theorem means you're choosing between consistency and availability during a partition." / "Cassandra is AP, CockroachDB is CP, but it's more nuanced than that."
Related Terms
Distributed Database
A distributed database spreads your data across multiple computers that work together like a hive mind. If one server dies, the others pick up the slack.
Eventual Consistency
Eventual consistency means 'give it a moment and everything will match up.' You write data to one server, and the other servers will get the update...
PACELC Theorem
PACELC is CAP theorem's smarter older sibling. It says: during a Partition, choose between Availability and Consistency.
Strong Consistency
Strong consistency means the moment you write something, everyone everywhere immediately sees the updated value. No 'give it a sec' nonsense.