分布式一致性算法Raft论文(4)——为易懂性设计

4 Designing for understandability

功能完整,实用是基础。更重要的是可理解性要好。

        We had several goals in designing Raft: it must provide a complete and practical foundation for system building, so that it significantly reduces the amount of design work required of developers; it must be safe under all conditions and available under typical operating conditions; and it must be efficient for common operations. But our most important goal—and most difficult challenge—was understandability. It must be possible for a large audience to understand the algorithm comfortably. In addition, it must be possible to develop intuitions about the algorithm, so that system builders can make the extensions that are inevitable in real-world implementations.

        我们在设计RAFT方面有几个目标:

  • 它必须为系统构建提供一个完整和实用的基础,从而大大减少开发人员所需的设计工作量;
  • 它必须在所有条件下都是安全的,
  • 并且在典型操作条件下可用;
  • 它必须对普通操作有效。
  • 但我们最重要的目标和最困难的挑战是可理解性。大量观众必须能够轻松地理解算法。此外,必须能够开发出关于算法的直觉,以便系统构建者能够进行在现实世界实现中不可避免的扩展。

        There were numerous points in the design of Raft where we had to choose among alternative approaches. In these situations we evaluated the alternatives based on understandability: how hard is it to explain each alterna- tive (for example, how complex is its state space, and does it have subtle implications?), and how easy will it be for a reader to completely understand the approach and its implications?

        在Raft的设计中有许多要点,我们必须在备选方案中进行选择。在这些情况下,我们根据可理解性评估了备选方案:解释每个备选方案有多困难(例如,其状态空间有多复杂,是否有微妙的含义?),读者完全理解该方法及其应用有多容易?


----------------------
         We recognize that there is a high degree of subjectiv- ity in such analysis; nonetheless, we used two techniques that are generally applicable. The first technique is the well-known approach of problem decomposition: wher- ever possible, we divided problems into separate pieces that could be solved, explained, and understood relatively independently. For example, in Raft we separated leader election, log replication, safety, and membership changes.

        我们认识到这种分析具有高度的主观性;尽管如此,我们使用了两种普遍适用的技术。第一种技术是众所周知的问题分解方法:

如果可能的话,我们将问题分为可以相对独立地解决、解释和理解的独立部分。

例如,在Raft中,我们分离了领导人选举、日志复制、安全性和成员更改。

---------------------
         Our second approach was to simplify the state space by reducing the number of states to consider, making the system more coherent and eliminating nondeterminism where possible. Specifically, logs are not allowed to have holes, and Raft limits the ways in which logs can become inconsistent with each other. Although in most cases we tried to eliminate nondeterminism, there are some situ- ations where nondeterminism actually improves under- standability. In particular, randomized approaches intro- duce nondeterminism, but they tend to reduce the state space by handling all possible choices in a similar fashion (“choose any; it doesn’t matter”). We used randomization to simplify the Raft leader election algorithm.

        我们的第二种方法是通过减少要考虑的状态的数量来简化状态空间,使系统更加一致,并且在可能的情况下消除不确定性。具体来说,log不允许有hole,raft限制了log相互不一致的方式。虽然在大多数情况下,我们试图消除不确定性,但在某些情况下,不确定性实际上改善了不可理解性。

特别是,随机方法引入了不确定性,但它们倾向于通过以类似的方式处理所有可能的选择来减少状态空间(“选择任何一种;无所谓”)。我们使用随机化来简化Raft leader选举算法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值