Over the last year or so, I kept stumbling on consensus algorithms usage and reading about various implementations of Raft in large open-source solutions. But I didn’t read the paper until I recently stumbled on a beautiful website and got the push to get into it. It had an amazing interactive flow explaining how raft works. I decided to carve out some time and read the paper.
Let’s introduce Raft.
Let’s explore the problem space first. Maintaining the same set of mutable data in multiple places is possibly one of the first problems to tackle while developing distributed systems. In a distributed system, there is no dedicated central authority or decision-maker. With Raft, the participating components in the system can collectively agree on stuff and that is exactly what consensus means. Raft is a distributed consensus algorithm that helps multiple participating nodes agree on a consistent state and it even helps with failing nodes.
Peeking inside Raft.
I’ll break down Raft’s responsibilities into a list of operations and we’ll work on our own Raft implementation.
- Leader Election
- Log Replication
- State Safety
I’ll tackle each of the sections in detail and document the code in the later part of the series.