证明分布式系统的 CAP 理论

cap简介

c.biancheng.net中解释:reads and writes always succeed

Gilbert 和 Lynch 在论文中的描述是:every request received by a non-failing node in the system must result in a response

c.biancheng.net中解释:the system continues to operate despite arbitrary message loss or failure of part of the system

Gilbert 和 Lynch 在论文中的描述是:the network will be allowed to lose arbitrarily many messages sent from one node to another;

①网络分区

c.biancheng.net中解释:all nodes see the same data at the same time

Gilbert 和 Lynch 在论文中的描述是:any read operation that begins after a write operation completes must return that value, or the result of a later write operation

反证法:

如下图,假设cap成立,则必须支持p(系统必须支持容错② ),即只能选择cp或者ap。如果 clientA 发送到 server1 ,然后更新 client1,这是没问题的,但是 server2 由于网络、机器故障等原因无法及时更新 client2,此时如果要保证p,只有两种选择:

  1. 回退 server1 操作,即cp
  2. 允许此次执行,即ap

① 当网络发生异常导致分布式节点之间只有部分节点能进行通讯,这种现象称为网络分区,俗称脑裂

② 根据上面对p的解释,发现上图情况ca架构没法处理,只有挂掉,其实说明了p就是让系统拥有网络问题的处理机制,你不给p,那系统出现网络问题就不知道怎么执行,而网络处理机制要么就是c,要么就是a,亦证明了系统架构只能是cp或者ap

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值