《Designing.Data-Intensive.Applications》笔记 四
第九章 一致性与共识
分布式系统最重要的的抽象之一是共识(consensus):让所有的节点对某件事达成一致。
最终一致性(eventual consistency)只提供较弱的保证,需要探索更高的一致性保证(stronger consistency)。
摘要:
- start by looking at one of the strongest consistency models in common use,linearizability(线性一致性)。
- then examine the issue of ordering events(事件顺序) in a distributed system,particularly around causality(因果关系) and total ordering(全局顺序).
- explore how to atomically commit a distributed transaction
Linearizability
非线性一致性案例:
全序
全序(total order)指允许任意两个元素进行比较,如自然数集就是全序的。
而数学集合不是全序的,如{a,b}与{b,c}不能比较大小,称为偏序。
线性一致性的系统中,操作是全序的;如果两个事件有因果关系,则它们有序,如果是并发的,则它们的顺序无法比较。这意味着因果关系定义了一个偏序。
因此线性一致性系统中,不存在并发操作。
线性一致性包含因果一致性。很多情况下,看上去需要线性一致性的系统,实际上只需要因果一致性,因果一致性可以更高效的实现。
兰伯特时间戳(Lamport timestamps)
计数器值大者是更大的时间戳,如计数器值相同,节点ID越大,时间戳越大。
兰伯特时间戳的关键思想:每个节点NODE、客户端Client跟踪迄今为止所见到的最大计数器值,并在每个请求中包含这个最大计数器值。当一个节点NODE收到的最大计数器值大于本身的计数器值,它立刻更新自己的计数器值。
全序广播(total order broadcast)
通常被描述为节点间交换消息的协议,要满足两个安全属性:
- 可靠交付(reliable delivery)
没有消息丢失:如果消息被传到一个节点,它将被传到所有节点 - 全序交付(totally ordered delivery)
消息以相同的顺序传递给每个节点
分布式事务与共识
共识是分布式计算中最重要也是最基本的问题之一。目标是让几个节点达成一致(get several nodes to agree on something)。
原子提交与二阶段提交算法(2PC,two-phase commit)
2PC的基本流程:
详细过程:
可能出现协调者失效的问题:
- 《Data-Intensive_Text_Processing0Awith_MapReduce》笔记第3章
- Maryland-Data-Intensive Information Processing Applications/Cloud Computing - Jimmy LIN
- Building Applications with Force.com and VisualForce(Dev401)(十一):Designing Applications for Multiple Users: Proseving Data Quality
- 《Data-intensive Text Processing with MapReduce》读书笔记第2章:MapReduce基础(3)
- pandas笔记3:修改Dataframe一列的最大值及loc,iloc用法
- 【ASP.NET开发】菜鸟时期的.net笔记[about data binding]
- Effective C#阅读笔记-1.使用属性(Properties)代替数据成员(Data Member)
- Python学习笔记 --- Pycharm中遇到 no data sources are configured to run thi s sql...
- sencha touch 学习笔记- 基本属性-data 、Record和tpl(ps:博客园phonegap版rss 阅读器可以用了,在被窝里逛园子)
- Building Applications with Force.com and VisualForce(Dev401)( 九):Designing Applications for Multiple Users: Putting It All Together
- spring data elasticsearch学习笔记_02自动化测试用例
- spring data elasticsearch学习笔记_03参数校验
- SPRING IN ACTION 第4版笔记-第九章Securing web applications-011-把敏感信息请求转为https(requiresChannel())
- [深度学习论文笔记][Weight Initialization] Data-dependent Initializations of Convolutional Neural Networks
- SPRING IN ACTION 第4版笔记-第十一章Persisting data with object-relational mapping-003编写JPA-based repository( @PersistenceUnit、 @PersistenceContext、PersistenceAnnotationBeanPostProcessor)
- Web Mining and Big Data 公开课学习笔记 ---lecture1
- 【深度学习】【caffe实用工具1】笔记23 Windows下【Caffe实用工具】之convert_cifar_data的用法
- 【NDN VANET】Data Naming in Vehicle-to-Vehicle Communications 学习笔记
- iOS笔记:查询结果为空,显示无数据的方法(UITableView Display No Data)
- MorningStar(Tenfore) DataFeed API调查笔记