当我试图理解CAP中的“Availability”(A)和“Partition tolerance”(P)时,我发现很难理解各种文章的解释。
我有一种感觉,a和P可以同时出现(我知道事实并非如此,这就是我不能理解的原因!)
简单地解释一下,什么是A和P以及它们之间的区别?
当我试图理解CAP中的“Availability”(A)和“Partition tolerance”(P)时,我发现很难理解各种文章的解释。
我有一种感觉,a和P可以同时出现(我知道事实并非如此,这就是我不能理解的原因!)
简单地解释一下,什么是A和P以及它们之间的区别?
当前回答
Brewer's keynote, the Gilbert paper, and many other treatments, places C, A and P on an equal footing as desirable properties of an implementation and effectively say 'choose two!'. However, this is often considered to be a misleading presentation, since you cannot build - or choose! - 'partition tolerance': your system either might experience partitions or it won't. CAP is better understood as describing the tradeoffs you have to make when you are building a system that may suffer partitions. In practice, this is every distributed system: there is no 100% reliable network. So (at least in the distributed context) there is no realistic CA system. You will potentially suffer partitions, therefore you must at some point compromise C or A.
https://github.com/henryr/cap-faq#10-why-do-some-people-get-annoyed-when-i-characterise-my-system-as-ca
其他回答
简单的CAP定理指出,分布式系统不可能同时提供所有三个保证:
一致性
每个节点同时包含相同的数据
可用性
每次必须至少有一个节点可用以提供数据
分区容忍
系统的故障是非常罕见的
大多数情况下,每个系统只能保证至少两个特性:CA、AP或CP。
Brewer's keynote, the Gilbert paper, and many other treatments, places C, A and P on an equal footing as desirable properties of an implementation and effectively say 'choose two!'. However, this is often considered to be a misleading presentation, since you cannot build - or choose! - 'partition tolerance': your system either might experience partitions or it won't. CAP is better understood as describing the tradeoffs you have to make when you are building a system that may suffer partitions. In practice, this is every distributed system: there is no 100% reliable network. So (at least in the distributed context) there is no realistic CA system. You will potentially suffer partitions, therefore you must at some point compromise C or A.
https://github.com/henryr/cap-faq#10-why-do-some-people-get-annoyed-when-i-characterise-my-system-as-ca
根据CAP定理,分布式系统有三个特征:
一致性(C)表示所有系统组件具有相同的信息。
系统的可用性(A)意味着它不会因为另一个系统故障而停止工作。
分区容差(P)表示在任意网络包丢失的情况下,系统将继续工作。
根据CAP定理,一个系统最多只能有这三个特征中的两个。(ap, cp, ca)
根据上图C是断开的,但A,B, D可以继续工作。现在我们可以调用系统部分工作(分区容忍)。
假设一个特定的事务只需要a、B和d,系统可以执行它而不会产生任何不一致。
但是当C必须参与一个特定的事务时,系统可以以两种方式执行。
1.由于C不可用,A可以拒绝用户请求。
So the system has Partition-Tolerance and consistency (P,C).
But no availability, because of the rejection.
2.A可以将C接收到的消息保存在A的本地内存中,并在C连接回来时传输。
So the system has Partition-Tolerance and availability (P,A).
But no consistency.because C has not updated.
一致性:
对于给定的客户端,读操作保证返回最近的写操作(如ACID)。如果在此期间有任何请求,则必须等待节点之间/节点内的数据同步完成。
可用性:
每个节点(如果没有失败)总是执行查询,并且应该总是响应请求。它是否返回最新的副本并不重要。
Partition-tolerance:
当发生网络分区时,系统将继续工作。
关于AP,可用性(始终可访问)可以与(Cassendra)或 没有(RDBMS)分区容忍
图片来源