当前位置:网站首页>CAP理论听起来很高大上,其实很简单
CAP理论听起来很高大上,其实很简单
2022-06-11 10:54:00 【zhanyd】
CAP理论听起来很高大上,其实很简单。
一致性(Consistency): 保证数据一定是一致的,对的
可用性(Availability):保证系统能用
分区容错性(Partition Tolerance):就算网络出了问题(分区),我也能忍
在分布式系统中,网络是肯定会出问题的,不可避免的,比如服务器挂了,程序挂了,网线被踢掉了,网络超时等等。
各个服务器原来通过网络连接,连成一片,在一个大的区域中,互相之间要同步数据,现在网络出了问题,各个服务器之间就断了联系,相互之间被隔离了,数据同步不了了,这就形成了分区。
出现了分区,我们也认了,这是网络错误,是无法避免的,所以分区容错性即P,在分布式系统中是一直存在的。
那在P存在的前提下,我们到底是选择保证:数据是对的比较重要呢(CP),还是保证系统能用比较重要呢(AP)?
CP:比如A服务器的数据是要同步给B服务器的,现在网断了,A的数据传不过去了,我觉得保证数据对比较重要,如果A和B的数据对不上,后果很严重,为了保证A和B服务器的数据一致,干脆让A停止服务好了,直接给客户端返回错误信息,等网络恢复了,再上线,免得A和B的数据不一致。
AP:比如A服务器的数据是要同步给B服务器的,现在网断了,A的数据传不过去了,我觉得暂时的数据不一致没什么大关系,系统能用最重要,那我就继续让A提供服务,等网络恢复了,再同步数据到B。
CAP的问题就是网络不通的情况下,我们优先保证数据一致,还是优先保证系统可用的问题。

边栏推荐
- RxJs fromEvent 工作原理分析
- Summary of English thesis reading knowledge
- 数字藏品系统源码搭建
- Metro roadmap cloud development applet source code and configuration tutorial
- DROID-SLAM: 用于单目双目RGBD相机的深度视觉SLAM
- 使用RSA与base64对字符串进行加密解密
- Taking the cooperation between different banks as an example, the construction of small program ecology
- Using domestic MCU (national technology n32g031f8s7) to realize pwm+dma control ws2812
- Why does a ddrx power supply design require a VTT power supply
- Golang compilation and linking parameters, runtime
猜你喜欢

How programmers do sidelines

Beginning an excellent emlog theme

Using ribbon to realize client load balancing

Wechat cloud development al short video one click face changing applet source code

使用 Ribbon 实现客户端负载均衡

使用Labelimg制作VOC数据集或yolo数据集的入门方法

New Zealand is one of the best countries for road safety

Using domestic MCU (national technology n32g031f8s7) to realize pwm+dma control ws2812

Metro roadmap cloud development applet source code and configuration tutorial

SurroundDepth:自监督多摄像头环视深度估计
随机推荐
错误的导航分类横条代码版本
Jerry's acquisition of ble OTA dual backup upgrade (can only be used for chips above 4mbits) [article]
Source code construction of digital collection system
杰理之BLE SPP 开启 pin_code 功能【篇】
启牛帮开通的证券账户是安全可信的吗?
C language course design topic
34. 在排序数组中查找元素的第一个和最后一个位置 ●●
Design and implementation of interest social software platform based on location service (LBS) SSM framework
985高校博士因文言文致谢走红!导师评价其不仅SCI写得好...
Unity font spacing
MySQL (IX)
How programmers do sidelines
Cloud image quality assistant IAPP source code
英文论文阅读知识总结
MWC 2022 lights up the future, and everything serves
Distance measurement - Euclidean distance
Summary of English thesis reading knowledge
Electron desktop development (development of an alarm clock [End])
使用Yolov5训练自己制作的数据集,快速上手
Is it safe to open an account online? Can ordinary people drive it?