第六周课后作业
作业一:
请简述 CAP 原理。
看了wikipedia关于CAP的描述和网络上大部分解读,虽然字面上都了解,但都觉得不够深入和清晰。个人觉得Robert Greiner对CAP的论述比较好理解。
The CAP Theorem states that, in a distributed system (a collection of interconnected nodes that share data.), you can only have two out of the following three guarantees across a write/read pair: Consistency, Availability, and Partition Tolerance - one of them must be sacrificed.
Consistency - A read is guaranteed to return the most recent write for a given client.
Availability - A non-failing node will return a reasonable response within a reasonable amount of time (no error or timeout).
Partition Tolerance - The system will continue to function when network partitions occur.
个人理解CAP关注的是对数据的读写操作,所以针对的是数据一致性问题,而不是分布式系统的所有功能。
对于系统的数据中心来说,一致性问题是其中的关键点之一。为了应对可能出现的分区容忍性问题(该现象容易出现),要么选择数据一致性,要么选择数据可用性。这是为了保证系统能正常工作的预防措施之一,如何选择一般取决于业务需求,如RDBMS选择的是一致性,而NOSQL选择的是可用性。
再往前一步讲,在没出现分区容忍性问题时,并不需要“三选二”。
CAP作为分布式系统的设计理论,个人觉得更多的作用在于提供一种思考方向,而不是一种约束。类似问题的解决方案还有BASE理论,事务补偿等。
作业二:
针对 Doris 案例,请用 UML 时序图描述 Doris 临时失效的处理过程(包括判断系统进入临时失效状态,临时失效中的读写过程,失效恢复过程)。
没时间做了
版权声明: 本文为 InfoQ 作者【iHai】的原创文章。
原文链接:【http://xie.infoq.cn/article/7826095871ee00482e9e97f2b】。文章转载请联系作者。
评论