Grokking the System Design Interview
Vote

0% completed

CAP Theorem

A distributed system keeps its data on more than one machine, and those machines talk over a network. Networks fail. The CAP theorem describes what a system can still promise when that happens.

The short version is this. When the network between the machines breaks, a distributed system can keep answering every request, or it can keep every answer correct. It cannot do both.

The name comes from three words: consistency, availability, and partition tolerance. This lesson explains each word, and then explains why the real choice is only between two of them.

.....

.....

.....

Like the course? Get enrolled and start learning!
Marc Schlossberg

Marc Schlossberg

· 7 months ago

In the earlier section 'Key Characteristics of Distributed Systems', it reads, 'By definition, availability is the time a system remains operational to perform its required function in a specific period. However, in this section it reads "Availability means every request received by a non-failing node in the system must result in a response."

One of these is a metric and the other is a non-functional requirement. This is a big difference! It's exactly the kind of difference that an interviewer will notice because it telegraphs that the candidate doesn't truly understand what they're talking about.

Marc Schlossberg

Marc Schlossberg

· 7 months ago

The diagram inaccurately shows RDBMS as the CA combo and NoSQL solutions for both CP & AP. In reality, there are no true CA options in a distributed system, RDBMS's are better for CA & NoSQL for AP.

Additionally, the last paragraph's usage of the word partition is confusing and inaccurate. At times it is correctly used to reference a network failure between nodes, but then other times it's used to refer the nodes themselves?

Simon Gigli

Simon Gigli

· a year ago

Why can't a system guarantee consistency and availability?

Let's say a node goes down, then wouldn't the system be able to return data from an active node? This would mean the system is available (able to return requests) and consistent (all users see the same up-to-date data).

Show 1 reply
D

designgurus

· 2 years ago

The diagram says RDBMS is C/A, but if it's at all distributed it's C/P

A

Aditya Bhave

· 2 years ago

It seems to me that unless the system is a read-only service (in which case, full data replication can be done across every node), you cannot really have CP. If the system is partitioned due to network loss, writes to one partition cannot be seen on the other partition till the network is restored. In other words, while the network is lost, consistency is lost

Show 1 reply

Reading Progress

0%