In Search of an Understandable Consensus Algorithm (2014) [pdf]
I&#x27;ll have to admit that over time I&#x27;ve ended up with mixed feelings about this paper. This is mainly due to people reading this paper without knowing much about consensus and drawing conclusions like &quot;Raft is better than Paxos&quot; or &quot;Raft is the best consensus algorithm&quot; though. Some thoughts (please elaborate if you think I&#x27;m simplifying it too much or if you disagree with me!):<p>First of all remember that Paxos is <i>a family of protocols</i> for solving consensus. When doing research it&#x27;s useful to reduce a problem into smaller and smaller parts. The &quot;standard&quot; Paxos algorithm is a very simple consensus algorithm which can only decide a single value once. It&#x27;s not practical at all, but provides a good framework for thinking about consensus.<p>When this article proposes &quot;Raft vs Paxos&quot; they are <i>actually</i> comparing Raft against a standard way of configuring Paxos with a leader (MultiPaxos). Note that MultiPaxos allows a lot of nuances in the implementations while still being called &quot;MultiPaxos&quot;. MultiPaxos is not a spec you implement; it&#x27;s a set of ideas.<p>Raft on the other hand is a concrete protocol with well-defined, specified behavior. In fact, Raft is essentially an implementation of MultiPaxos[1]. This is a very good thing! Paxos provides a framework for thinking about consensus, while Raft puts some of these ideas into a concrete specification which is easy to implement. And it is a good point that we should make the knowledge in the field of consensus available for a wider audience. Yay, Raft is good!<p>And here comes the problem: A lot of people have read the Raft paper and made the conclusion that &quot;Raft is the best way of solving consensus&quot;. Raft is (relatively) easy to implement and get started with and gives you a very simple model to program for (a log of commands), but it&#x27;s far from a panacea.<p>The most important thing to know about Raft is that it&#x27;s not performant (every command has to be sent to a single leader which becomes a bottleneck) nor scalable (every command needs to be processed by all nodes). Etcd supports &quot;1000s of writes&quot; and recommends up to &quot;7 nodes&quot;.<p>This doesn&#x27;t mean that Raft is <i>bad</i>; it&#x27;s just a trade-off you need to be aware of. Simplicity vs performance. If you&#x27;re integrating Raft into your stack and aim for scalability&#x2F;performance you must always be very weary of when you use it. You should minimize writes at all costs. Unfortunately many developers gets the impression that you can just plug Raft into an existing system and suddenly have a performant and scalable distributed system.<p>A good example is CockrouchDB: They&#x27;re using plain Raft for writes, but uses &quot;leader leases&quot; for scaling reads. Suddenly things become a lot more complicated (for instance see this issue about how leader leases are implemented in the Go library for Raft: <a href="https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;raft&#x2F;issues&#x2F;108" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;raft&#x2F;issues&#x2F;108</a>). I&#x27;m sorry, but you&#x27;re going to have to get your hands dirty if you want something that&#x27;s both fast and correct.<p>The end result is that you have two choices: (1) You can use a library which provides a simple model (a log of commands), but doesn&#x27;t scale well or (2) you can use a more complicated consensus algorithm and then deal with all of the Hard Problems™ that comes with it. If you&#x27;re going for the second option, you might as well take advantage of all of the research discovered in the last few years (see <a href="https:&#x2F;&#x2F;vadosware.io&#x2F;post&#x2F;paxosmon-gotta-concensus-them-all&#x2F;" rel="nofollow">https:&#x2F;&#x2F;vadosware.io&#x2F;post&#x2F;paxosmon-gotta-concensus-them-all&#x2F;</a>)<p>It should also be noted that even though the <i>consensus</i> algorithm doesn&#x27;t scale, it doesn&#x27;t mean your system can&#x27;t scale. Scalog (<a href="https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;nsdi20-paper-ding.pdf" rel="nofollow">https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;nsdi20-paper-ding.pdf</a>) is an example of a system which uses a consensus algorithm in a constant way (i.e. regardless of load of the system). Once again: Focus on how you can <i>avoiding</i> using a consensus algorithm due to the way <i>your</i> system works.<p>TL;DR: Hard problems are still hard. Don&#x27;t think that Raft is a magical piece of software which solves all of your problems.<p>[1]: There are some nuances between Raft and &quot;standard&quot; MultiPaxos as mentioned in <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2004.05074" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2004.05074</a>. I would still consider Raft to be in the same class as MultiPaxos (compared to other solutions of consensus).