Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

In search of a simple consensus algorithm

$
0
0

One may think that since all the tested systems are affected by this issue then probably it's inevitable for all the consensus protocols.

Luckily, it isn't true. Epaxos is an example of a leaderless consensus protocol, but it isn't the only one - it's pretty easy to come up with a design of a "leaderless" system built on top of known battle-tested ideas.

For example, instead of using a distributed log as an Event Sourcing backend for building a key/value storage as an interpretation of an ordered stream of updates we can run a distributed log instance per key. It distributes different leaders across different nodes to achieve the same effect as a leaderless consensus does: a failure of one node doesn't affect the unavailability of the whole cluster.

A log per key looks like overkill. Hopefully, we have a simpler alternative: Single Decree Paxos (Synod). Multi-Paxos (a log) is an abstraction on top of an array of write-once registers implemented with the Single Decree Paxos algorithm, but nothing prevents us from using the same algorithm to build a rewritable register. Once we have it then creating a key/value storage becomes a trivial task since a key/value storage is by definition is a tagged set of rewritable registers.

As far as I know, there isn't a computer science paper dedicated solely to the topic of building a rewritable register on top Single Decree Paxos. But the idea is known both in the industry (see TreodeDB) and in academia (Heidi Howard, Cambridge Ph.D. student, described it in her presentation and going to cover in the Ph.D. thesis).

I practiced logic and proved it in the How Paxos works post, but the proof wasn't peer reviewed so use it at your risk :) However, it was enough for me, so I built Gryadka, a toy key/value storage of 500 line of code, and extensively tested it with the fault injection technique.

Besides the consistency testing, I measured the unavailability window by using the same method I used with Etcd, CockroachDB, RethinkDB and TiDB. Since Gryadka is based on a leaderless (multi-leader) consensus protocol it demonstrated zero downtime both when a node was crashed and when it was isolated.

Gryadka (crash)

182 435 147 143 145
183 435 146 144 145
184 412 116 148 148
185 296   0 149 147
186 309   0 154 155
187 289   0 145 144

Gryadka (isolation)

94 465 152 156 157
95 455 151 149 155
96 453 143 154 156
97 318   0 157 161
98 292   0 144 148
99 290   0 144 146

Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>