Explain Raft vs Paxos vs Zab

Raft vs Paxos vs Zab compares three distributed consensus algorithms used to keep multiple servers in sync despite failures.

When to Use

  • Paxos: Best for mission-critical systems needing mathematical rigor (e.g., Google Spanner).
  • Raft: Ideal for new projects prioritizing simplicity and developer readability (e.g., etcd, Consul).
  • Zab: Purpose-built for ZooKeeper clusters to ensure ordered broadcast and leader election.

Example

Think of three friends trying to agree on a movie. Paxos is like a complex voting system, Raft elects one leader to decide, while Zab is a custom rulebook written just for their group.

To master such system design fundamentals, check out Grokking System Design Fundamentals, Grokking the System Design Interview, or try Mock Interviews with ex-FAANG engineers.

Why Is It Important

Consensus ensures data consistency and fault tolerance. Without it, distributed databases, queues, and coordination services would risk split-brain or data loss.

Interview Tips

Start by defining consensus, then contrast: Paxos (proven but complex), Raft (leader-driven and easier to explain), Zab (specialized for ZooKeeper). Drop real-world systems using each.

Trade-offs

  • Paxos: Strong correctness, hard to implement.
  • Raft: Simpler but less general.
  • Zab: Efficient in ZooKeeper but not widely applicable.

Pitfalls

  • Over-focusing on protocol phases instead of practical use.
  • Confusing Zab with Paxos (Zab is separate).
  • Assuming one is always superior—context matters.
TAGS
System Design Interview
System Design Fundamentals
CONTRIBUTOR
Design Gurus Team
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Image
One-Stop Portal For Tech Interviews.
Copyright © 2025 Design Gurus, LLC. All rights reserved.