CAP Theorem is NOT pick 2 of 3
45sChallenges a common misconception in system design, making viewers feel they've been misled and eager to learn the truth.
▶ Play Clip"Delivers a clear, concise explanation that matches the title, though it's brief and promotional."
This video explains the CAP theorem in the context of system design interviews, clarifying that it is not about choosing two of three guarantees but rather about making a single decision when a network partition occurs: whether to prioritize consistency or availability. It uses relatable examples to illustrate the trade-off and provides a simple heuristic for interview answers.
CAP theorem stands for consistency, availability, and partition tolerance. Classic framing says a distributed system can only guarantee two of three.
In a distributed system, network partitions are inevitable, so partition tolerance is not optional. Therefore, the real choice is between consistency and availability when a partition occurs.
When the network fails, you must decide: return possibly stale data (availability) or return an error (consistency).
For a social app, showing stale data (old picture) is acceptable, so you choose availability.
For Ticketmaster selling the last seat, you would return an error to avoid selling the same seat twice, so you choose consistency.
In an interview, don't recite the three letters. Instead, answer the question: Is stale data acceptable or not?
The CAP theorem in practice is a simple trade-off between consistency and availability when partitions occur. For interviews, focus on whether stale data is acceptable for the specific use case.
What does CAP stand for?
Consistency, Availability, Partition tolerance.
00:01
Why is partition tolerance not optional in distributed systems?
Because network partitions are inevitable in distributed systems.
00:14
When a network partition occurs, what is the real choice?
Whether to return possibly stale data (availability) or return an error (consistency).
00:27
In a social app, which does the video recommend: consistency or availability?
Availability, because stale data is acceptable.
00:40
In the Ticketmaster example, why choose consistency?
To avoid selling the same seat twice, so you return an error.
00:52
What is the key interview tip for CAP theorem?
Don't recite the three letters; answer whether stale data is acceptable or not.
01:04
Partition tolerance is non-optional
Reframes CAP theorem from a three-way choice to a binary decision, simplifying the concept.
00:14Social app example
Illustrates a real-world scenario where availability is preferred.
00:40Ticketmaster example
Shows a contrasting case where consistency is critical.
00:52Interview heuristic
Provides a practical, memorable rule for answering CAP theorem questions in interviews.
01:04[00:01] with a choice about CAP theorem, but the real decision is a lot simpler than you refresher. CAP theorem stands for consistency, availability, and partition tolerance. The classic framing is that a distributed system can only guarantee
[00:14] two of the three. But, in a distributed system, the network will eventually partition tolerance is not optional. This means that CAP theorem isn't asking you to pick two of three. It's actually just asking one simple question. When
[00:27] the network does fail, do you return possibly stale data, which would mean an error, which would mean choosing consistency? Let's look at an example. Say your user updates their profile in the United States, and the connection to
[00:40] your Europe server goes down before that update is replicated. Then, a user in Europe requests the profile. Well, you have two options. You can show them the old picture, or you can refuse to answer until the network heals. For a social
[00:52] app, you'd clearly show them the old picture. Stale data is fine. An error availability. For Ticketmaster, on the other hand, selling the last seat at a concert, you would return an error. You'd rather tell somebody try again
[01:04] than sell the same seat twice. That's consistency. And so, when an interviewer three letters altogether. Just answer this one question. Is stale data acceptable or not? For a full breakdown on CAP theorem, head over to
[01:17] hellointerview.com. Our link is in the bio.
⚡ Saved you 0h 01m reading this? Transcribe any YouTube video for free — no signup needed.