问题描述
在阅读了paxos和木筏纸之后,我有以下困惑:paxos论文仅描述了关于单个日志条目的共识,这等同于筏算法的领导者选举部分.在木筏的领导人选举中,paxos的方法比简单的随机超时方法有什么优势?
After reading paxos and raft paper, I have following confusion:paxos paper only describe consensus on single log entry, which is equivalent the leader election part of the raft algorithm. What's the advantage of paxos's approach over the simple random timeout approach in raft's leader election?
推荐答案
常见的误解是,原始Paxos论文没有使用稳定的领导者.在 Paxos变得简单在标题为实施"的第6页上,Lamport写道:
It is a common misconception that the original Paxos papers don't use a stable leader. In Paxos Made Simple on page 6 in the section entitled "The Implementation" Lamport wrote:
这是使用准备"和承诺"的第一阶段消息传递来简单实现的.
This is simply achieved using the Phase 1 messaging of prepare and promises.
然后在第9和10页的实现状态机"部分下,我们有:
Then on pages 9 and 10 under the section "Implementing a State Machine" we have:
在这里,从最一般的意义上讲,它使用的是状态机"一词,涵盖了显而易见的情况,例如键值存储或数据库服务器,我们在其中复制了应用于该存储的操作日志.
Here it is using the term 'state machine' in the most generic sense covering the obvious cases such as a key value store or database server where we replicate a log of actions applied to the store.
人们对此感到困惑,因为Lamport证明Paxos的方式已经成为现在的教学方式. Lamport通过将其简化为可以推理的数学模型,证明了称为Paxos的一类应用程序的正确性.他在原始论文兼职议会:
People get confused about this because of the way Lamport proved Paxos which is now the way it is taught. Lamport proved the correctness of a class of applications known as Paxos by stripping it down to a mathematical model that can be reasoned about. He called this "The Single-Decree Synod" in the original paper The Part-Time Parliament:
如果您发现该陈述令人困惑,请不要担心这是一个坏笑话;字面上地.用我自己的话来说,这样的翻译是:
If you find that statement confusing don’t worry it is a bad joke; literally. A translation of this in my own words would be:
为了证明我的解释的正确性,我们可以看一下标题为多法令议会"的第3节,内容为:
In order to justify my interpretation we can look at Section 3 entitled "The Multi-Decree Parliament" which says:
为解决这一点,最初的兼职议会"论文介绍了Paxos,因为它具有多级算法,因此对计算机科学家来说很有趣;议会议定书.该说明和澄清文件"Paxos变得简单"都将Paxos定义为具有杰出的领导者,可为命令流分配序列号.此外,尊贵的领导者仅在担任领导职务时才发送准备"消息;之后,在稳定状态下,杰出的领导者仅流式传输接受"消息.他还说,要在其他地方折叠角色并让所有服务器都运行算法的所有三个角色.
To labour the point both the original "The Part-Time Parliment" paper introducing Paxos as interesting to computer scientists because of its multi-degree algorithm; the parliament protocol. That and the clarification paper "Paxos Made Simple" both define Paxos as having a distinguished leader assigning sequence numbers to a stream of commands. Furthermore the distinguished leader only sends "prepare" messages when it assumes leadership; after that in steady state the distinguished leader streams only "accept" messages. He also says else where in the paper to collapse the roles and have all servers run all three roles of the algorithm.
这篇关于Paxos vs Raft进行领导人选举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!