• CAP理论


    2000年7月,美国加州大学伯克利分校的Eric Brewer教授在ACM PODC会议上提出了CAP猜想。2年后,麻省理工学院的Seth Gilbert和Nancy Lynch从理论上证明了CAP。之后,CAP理论正式成为分布式计算领域的公认定理。

    consistency 一致性

    Gilbert 和 Lynch 在论文中的描述是:​​​​​​​

    any read operation that begins after a write operation completes must return that value, or the result of a later write operation

    意思就是,一个写操作完成后,之后的读操作必须得到前面写入的最新的值。

    availability 可用性

    Gilbert 和 Lynch 在论文中的描述是:

    every request received by a non-failing node in the system must result in a response

    意思是,任何一个请求到达系统可用节点后,必须得到响应。 

    partition tolerance 分区容错性

    Gilbert 和 Lynch 在论文中的描述是:

    the network will be allowed to lose arbitrarily many messages sent from one node to another

    意思是,节点之间有任意多消息丢失时,系统要能容忍并继续工作。 

    维基百科从效果上对CAP的含义做了高度的概括:

    Consistency : Every read receives the most recent write or an error
    Availability : Every request receives a (non-error) response – without the guarantee that it contains the most recent write
    Partition tolerance : The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes

    一致性要求相同或相关数据在被更新后必须被读取到。

    可用性要求节点必须对任意请求做出响应。

    分区容错性要求节点之间通信异常时,系统依然要工作。

     不同组合的系统

     CA类型的系统,放弃分区,就是单节点,可以提供一致性和可用性,这里不要考虑不可抗因素,比如硬件损坏等。

    CP类型的系统,放弃可用性,当分区发生时,数据不及时的分区直接停止服务。

    AP类型系统,放弃一致性,当分区发生时,数据不及时的分区也提供服务。

    主流系统的选择

    当前系统都会保留P,所以会在C和A之间做权衡,目前主流系统都是选择A,然后舍弃强一致性,选择最终一致性。AP和最终一致性是我们优先考虑的系统架构。

  • 相关阅读:
    Kafka:介绍和内部工作原理
    java入门,记一次微服务间feigin请求的问题
    浅析人脸活体检测技术的功能及几种分类
    uniapp实现公众号微信登录
    用于数据分析和数据科学的SQL教程
    (5)Flink CEP SQL四种匹配模式效果演示
    Vue组件化开发步骤
    前端字符串方法汇总
    抖音直播运营 | 疫情时代下如何用直播驱动品牌业务增长
    社区迭代|ETLCloud社区新增“论坛”啦!
  • 原文地址:https://blog.csdn.net/tales522/article/details/126921132