Skip to content

Commit e091086

Browse files
author
代码风水师
committed
添加了CAP原则。
1 parent dcf05da commit e091086

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125

126126
### 八、:telescope::tokyo_tower::satellite:分布式系统
127127
* [分布式系统 (第 01 篇) 精讲:集群与分布式]()
128-
* 分布式系统 (第 01 篇) 精讲:CAP定理与Base理论
128+
* 分布式系统 (第 01 篇) 精讲:CAP原则与BASE理论
129129
* 分布式系统 (第 01 篇) 精讲:2PC协议和3PC协议
130130
* 分布式系统 (第 01 篇) 精讲:TCC事务补偿机制(柔性事务方案)
131131
* 分布式系统 (第 01 篇) 精讲:拜占庭将军问题
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
1+
<h3 style="padding-bottom:6px; padding-left:20px; color:#ffffff; background-color:#E74C3C;">一、CAP原则</h3>
12

3+
**CAP原则** (又称*CAP*定理) 是指一个分布式系统中,*Consistency*(一致性)、 *Availability*(可用性)、*Partition tolerance*(分区容错性),三者不可兼得。
4+
5+
![CAP原则]()
6+
7+
#### 1、一致性(Consistency)
8+
9+
> 在分布式系统中的所有数据备份,在同一时刻是否同样的值。(等同于所有节点访问同一份最新的数据副本)
10+
11+
12+
13+
#### 2、可用性(Availability)
14+
15+
> 在集群中一部分节点故障后,集群整体是否还能响应客户端的读写请求。(对数据更新具备高可用性)
16+
17+
18+
19+
#### 3、分区容错性(Partition tolerance)
20+
21+
> 以实际效果而言,分区相当于对通信的时限要求。系统如果不能在时限内达成数据一致性,就意味着发生了分区的情况,必须就当前操作在C和A之间做出选择。
22+
23+
24+
25+
---
26+
27+
<h3 style="padding-bottom:6px; padding-left:20px; color:#ffffff; background-color:#E74C3C;">二、BASE理论</h3>
28+
29+
**BASE** 基本可用(Basically Available)、软状态(Soft state)、最终一致(Eventually consistent)三个短语的缩写。BASE是对CAP中一致性和可用性权衡的结果,其来源于对大规模互联网系统分布式实践的结论,是基于CAP定理逐步演化而来的,其核心思想是即使无法做到强一致性(Strong consistency),但每个应用都可以根据自身的业务特点,采用适当的方式来使系统达到最终一致性(Eventual consistency)。
30+
31+
#### 1、基本可用(Basically Available)
32+
33+
34+
35+
#### 2、软状态(Soft state)
36+
37+
38+
39+
#### 3、最终一致(Eventually consistent)

0 commit comments

Comments
 (0)