分布式系统的设计需要考虑CAP理论:一个分布式系统,无法同时满足CAP三个指标。
CAP是三个指标:
维基百科中,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
从字面意思来说,
对于一个分布式系统,必须满足分区容忍性P。而当出现分区错误时,必须在一致性C和可用性A之间做出抉择。
当选择一致性C,由于分区数据不是最新,那么会返回错误或者一直等待至数据更新才返回。 (这个结果不满足可用性A)
当选择可用性A,即使分区数据不是最新,也会返回当前分区的数据。(这个结果不满足一致性C)
author‘s blog == http://www.cnblogs.com/toulanboy/
原文:https://www.cnblogs.com/toulanboy/p/14621376.html