狠狠撸

狠狠撸Share a Scribd company logo
分布式技术原理(一)
17/Dec/2020 @DXY
分布式基础
●
CAP
分布式基础
●
CAP
CAP
一个分布式系统最多只能同时满足:
●
一致性( Consistency )
●
可用性( Availability )
●
分区容忍性( Partition Tolerance )
这三项中的两项。
C
●
一致性
指“所有节点同时看到相同的数据”,
即更新操作成功并返回客户端完成后,
所有节点在同一时间的数据完全一致,
等同于所有节点拥有数据的最新版本。
A
●
可用性
“ 任何时候,读写都是成功的”,
即服务一直可用,
而且是正常响应时间。
P
●
分区容忍性
“ 当部分节点出现消息丢失或者分区故障的时候,
分布式系统仍然能够继续运行”,
即系统容忍网络出现分区,
遇到某节点或网络分区之间网络不可达的情况下,
仍然能够对外提供满足一致性或可用性的服务。
CAP
●
在分布式系统中, P 是确定的。
CAP 应用模型就是 CP 架构和 AP 架构。
●
分布式系统所关注的,就是在 分区容忍 的前提下,如何
实现更好的 A 和更稳定的 C 。
CAP
●
CP : zookeeper
●
AP : eureka
CAP
●
CAP 理论的证明
反正法
CAP
●
工程上来说,放弃强一致性
(这里说的一致性是强一致性),
追求分区容错性和可用性,
这是很多分布式系统设计时的选择
CAP→ BASE
●
工程上来
BASE
●
基本可用
不追求 CAP 中的「任何时候,读写都是成功
的」,而是系统能够基本运行,一直提供服务。基
本可用强调了分布式系统在出现不可预知故障的时
候,允许损失部分可用性,相比正常的系统,可能
是响应时间延长,或者是服务被降级。
BASE
●
软状态
可以对应 ACID 事务中的原子性,实现的是强制一致性,要么全做要
么不做,所有用户看到的数据一致。
其中的原子性要求多个节点的数据副本都是一致的,强调数据一致性。
原子性可以理解为一种“硬状态”,
软状态则是允许系统中的数据存在中间状态,并认为该状态不影响系统
的整体可用性,即允许系统在多个不同节点的数据副本存在数据延时。
BASE
●
最终一致性
数据不可能一直是软状态,
必须在一个时间期限后达到各节点的一致
性,在期限过后,应当保证所有副本保持数
据一致性,也就是达到数据的最终一致性。
BASE
●
NoSQL
●
Microservice
Paxos
●
Paxos 是共识算法
不是一致性算法
●
Quorum
Zookeeper
●
Zab
ZooKeeper
Atomic
Broadcast
Zookeeper
Zookeeper
●
消息广播阶段
●
崩溃恢复阶段 (epoch,Zxid,serverid)
整个 ZooKeeper 集群的一致性保证就是
在上面两个状态之前切换
ETCD
●
Raft
●
数据,类似的两阶段提交
●
选举,每节点内部都有计时器
:)
Q&A
Ad

Recommended

tengine(nginx with lua ) develop at 2013
tengine(nginx with lua ) develop at 2013
druggo2
?
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
?
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
?
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
?
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
?
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
The six step guide to practical project management
The six step guide to practical project management
MindGenius
?
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
?
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
?
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
?
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
?

More Related Content

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
?
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
?
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
The six step guide to practical project management
The six step guide to practical project management
MindGenius
?
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
?
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
?
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
?
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
The six step guide to practical project management
The six step guide to practical project management
MindGenius
?
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
?
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
?
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
?

distribution tech system principle ( one )