Databases Reference
In-Depth Information
Partition tolerance —The ability of the system to keep responding to client
requests even if there's a communication failure between database partitions.
This is analogous to a person still having an intelligent conversation even after a
link between parts of their brain isn't working.
Remember that the CAP theorem only applies in cases when there's a broken connec-
tion between partitions in your cluster. The more reliable your network, the lower the
probability you'll need to think about CAP .
The CAP theorem helps you understand that once you partition your data, you
must consider the availability-consistency spectrum in a network failure situation.
Then the CAP theorem allows you to determine which options best match your busi-
ness requirements. Figure 2.10 provides an example of the CAP application.
The client writes to a primary master node, which replicates the data to another
backup slave node. CAP forces you to think about whether you accept a write if the
communication link between the nodes is down. If you accept it, you must take
responsibility for making sure the remote node gets the update at a later time, and
you risk a client reading inconsistent values until the link is restored. If you refuse the
write, you sacrifice availability and the client must retry later.
Although the CAP theorem has been around since 2000, it's still a source of confu-
sion. The CAP theorem limits your design options in a few rare end cases and usually
only applies when there are network failures between data centers. In many cases, reli-
able message queues can quickly restore consistency after network failures.
Normal operation
High-availability option
Consistency option
Accept write
Refuse write
Write
Ok
Master
node
Master
node
Master
node
X
Client
Client
Client
X
X
Copy
Link down
Link down
Read
Slave
node
Slave
node
Slave
node
Client
Figure 2.10 The partition decision. The CAP theorem helps you decide the relative
merits of availability versus consistency when a network fails. In the left panel, under
normal operation a client write will go to a master and then be replicated over the
network to a slave. If the link is down, the client API can decide the relative merits of
high availability or consistency. In the middle panel, you accept a write and risk
inconsistent reads from the slave. In the right panel, you choose consistency and block
the client write until the link between the data centers is restored.
Search WWH ::




Custom Search