CAP

用户头像
Kiroro
关注
发布于: 2020 年 07 月 15 日

Consistency



Consistency means that all clients see the same data at the same time, no matter which node they connect to. For this to happen, whenever data is written to one node, it must be instantly forwarded or replicated to all the other nodes in the system before the write is deemed ‘successful.’



Availability



Availability means that that any client making a request for data gets a response, even if one or more nodes are down. Another way to state this—all working nodes in the distributed system return a valid response for any request, without exception.



Partition tolerance



partition is a communications break within a distributed system—a lost or temporarily delayed connection between two nodes. Partition tolerance means that the cluster must continue to work despite any number of communication breakdowns between nodes in the system.



The CAP theorem categorizes systems into three categories:

  • CP (Consistent and Partition Tolerant) — At first glance, the CP category is confusing, i.e., a system that is consistent and partition tolerant but never available. CP is referring to a category of systems where availability is sacrificed only in the case of a network partition.

  • CA (Consistent and Available) — CA systems are consistent and available systems in the absence of any network partition. Often a single node's DB servers are categorized as CA systems. Single node DB servers do not need to deal with partition tolerance and are thus considered CA systems. The only hole in this theory is that single node DB systems are not a network of shared data systems and thus do not fall under the preview of CAP.

  • AP (Available and Partition Tolerant) — These are systems that are available and partition tolerant but cannot guarantee consistency.



Databases that follow ACID (Atomicity, Consistency, Isolation, Durability) give priority to consistency. However, NoSQL distributed databases prefer availability over consistency since availability is often part of commercial service guarantees. So caching and logging were used for eventual consistency. This leads to what we call BASE (Basically Available, Soft-state, Eventually consistent)



用户头像

Kiroro

关注

还未添加个人签名 2020.05.30 加入

还未添加个人简介

评论

发布
暂无评论
CAP