当前位置:网站首页>01-分布式系统概述
01-分布式系统概述
2022-06-28 09:13:00 【&再见萤火虫&】
目录
文章内容来自:南京大学 / 星环科技课程,大数据理论与实践课程Ⅰ
一,什么是分布式系统
1,概念
将硬件或软件组件(服务)分布在不同的网络计算机上,通过消息传递进行通信和协调。
2,特点
分布性
对等性
- 平等:无主从之分
- 独立:拥有自己的CPU和内存,独立处理数据
并发性
- 外部:承载多个客户端的并发访问
- 内部:作业(Job)被分解成多个任务(Task),并发运行在不同的节点上
故障独立性
- 部分节点出现故障不影响整个系统的正常使用
3,典型问题
通信异常
网络分区(脑裂)
- 系统分裂为两个甚至多个局部小集群(分区)
- 各分区独立运行,同时提供服务,从而导致混乱
节点故障
- 宕机或僵死
三态
- 成功、失败和超时
二,CAP定理
1,C、A、P
C(Consistency,一致性)
- 含义:同一时刻,数据在不同节点的多个副本是否具有完全相同的值
- 强一致性:数据更新完成后,同一时刻,不同的读操作都能获得最新的值
- 弱一致性:数据更新完成后,同一时刻,不同的读操作不一定都能获得最新的值,也无法保证多长时间之后可以获得最新的值
A(Availability,可用性)
- 含义:对于每一次请求,系统是否都能在有限(指定)的时间内做出响应
P(Partition Tolerance,分区容错性)
- 含义:当发生网络分区时,系统仍能对外提供满足一致性C和可用性A的服务
2,CAP定理
表述:分布式系统在同一时间片段内,不可能同时满足一致性C、可用性A和分区容错性P,最多只能满足其中的两项。
对分布式系统而言,网络分区无法避免,满足P是前提条件,所以不可能选择CA架构,只能选择CP或AP架构。
例如:发生网络分区时,某个节点正在进行写操作
(1)如果为了保证C,必须禁止其他节点的读写操作,那就与A冲突了
(2)如果为了保证A,其他节点正常读写,那就与C冲突了
选择CP或AP架构,关键在业务场景。例如:对于必须确保强一致性的银行业务,只能选择CP
三,BASE理论
1,BA、S、EC
BA(Basically Availability,基本可用性)
- 当系统发生故障时,在确保核心功能和指标有效的提前下,允许损失部分可用性,包括响应时间上的损失、非核心功能上的损失等
S(Soft State,软状态)
- 允许数据存在中间状态(暂时未更新),且该状态不会影响整体可用性
- 允许不同节点上的数据副本的同步过程存在一定延时
EC(Eventually Consistency,最终一致性)
- 分布在不同节点上的数据副本,在经过一定时间的同步后,最终达到一致状态。例如:Zookeeper、HDFS QJM写事务的过半策略
- 弱一致性的升级版
二,BASE理论
表述:分布式系统在满足分区容错性P的同时,允许数据软状态S的存在,并实现基本可用性BA和最终一致性EC。
即在满足P的前提下,对CAP中的强一致性A和绝对可用性C进行适度妥协:A-》BA、C-》EC
通过容忍部分数据的暂时不一致(软状态),即牺牲数据的强一致性(确保最终一致性),以确保系统的核心功能和指标有效(基本可用)
BASE理论是对大规模互联网系统分布式实践的总结,是对 CAP 中的一致性和可用性进行一个权衡的结果。
边栏推荐
- Copy & Deepcopy
- DEJA_ Vu3d - 052 of cesium feature set - Simulation of satellite orbit (high altitude) effect
- Discussion on the practice of fire emergency lighting system in the field of building electrical design
- Protection range and optimization of motor protector for hoist equipment
- Guangzhou: new financial activities and new opportunities for enterprises
- 华泰证券网上开户安全吗 办理流程是什么
- Implementation of single sign on
- Implementation of single sign on
- 1182:合影效果
- [.Net6] GRP server and client development cases, as well as the access efficiency duel between the minimum API service, GRP service and traditional webapi service
猜你喜欢

Prototype chain JS

Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.

containerd1.5.5的安装

Data modeling based on wide table

How to solve the problem of high concurrency and seckill

Basic knowledge of hard disk (head, track, sector, cylinder)

How to solve the problem of port number occupation

Redis5.0 slot migration, free play (single machine migration cluster)

Valentine's Day - VBS learning (sentences, love words)
理解IO模型
随机推荐
STL - inverter
Almost union find (weighted union search)
Discussion on the practice of fire emergency lighting system in the field of building electrical design
containerd1.5.5的安装
Using transform:scale causes the page mouse hover event to disappear
在本类私有属性直接使用?new()在使用!!!
Application of current limiting protector in preventing electrical fire in shopping malls
SQL注入之文件读写
批量修改表和表中字段排序规则
Common test method used by testers --- orthogonal method
构造方法绝不是在new()之后就立马执行!!!!!
High rise building fire prevention
Fastjason filter field
Illustration of MySQL binlog, redo log and undo log
Redis5.0 slot migration, free play (single machine migration cluster)
1182: effets de la photo de groupe
用Pytorch搭建第一个神经网络且进行优化
Deployment of MySQL database in Linux Environment
Quickly understand JVM structure and working principle
Analysis of prepaid power purchase device