Search⌘ K
AI Features

Paxos and Raft

Learn how Paxos and Raft consensus algorithms work to achieve agreement and leader election in distributed systems. Understand the phases of Paxos, including Prepare and Accept, and how Multi Paxos optimizes communication. Discover Raft’s simplified approach with leader election and log replication to maintain consistency across hosts.

We'll cover the following...

Basic Paxos

Paxos is a family of consensus algorithms that work in a distributed system. The Paxos algorithm was developed by Leslie Lamport and published in his 1998 paper, “The Part-Time Parliament.”

The host proposing a value is a proposer and the host accepting the proposal is an acceptor. Basic Paxos is the most basic consensus algorithm of the Paxos family. Basic Paxos has two phases, Phase 1 and Phase 2.

Phase 1

Phase 1 also has two subphases:

  • Prepare

  • Promise

In the prepare phase, the proposer creates a Prepare message with a number X, which is a unique identifier of the message and greater than any of the previous Prepare messages from that proposer. Now, the proposer sends this message to a Quorum of acceptor hosts.

Once the acceptor receives the message, there are two scenarios:

  • If ...