KatInterview

Consensus Protocols: Architectural Trade-offs and Implementation

System DesignModel answer
HardModel answerSystem Designdistributed-systemsconsensusfault-tolerance

Last updated

Contrast two distributed consensus approaches, analyzing their mechanisms for leader election, replication, and fault tolerance to recommend one for a production service.

You're designing a distributed system that needs strongly consistent state machine replication across multiple nodes. Your team is evaluating two well-known consensus protocols for the coordination layer.

Provide a technical comparison covering:

  1. Core mechanism: How does each protocol ensure replicas agree on command order?
  2. Leadership: How do nodes select and maintain a coordinator?
  3. Replication semantics: How do logs converge across replicas?
  4. Quorum dynamics: What voting majorities are required for progress?
  5. Configuration changes: How does the cluster safely add or remove members?
  6. Partition behavior: What happens when the network splits?

Then walk through these operational scenarios:

  • The current coordinator crashes mid-operation
  • Network delays cause message reordering
  • A node loses durable storage and rejoins

Finally, recommend one protocol for a new storage service where operational simplicity and debuggability are critical requirements. Justify your choice with specific trade-offs.

Hints

Hint 1

Start by establishing the common foundation: failure model, quorum intersection, and safety vs liveness guarantees

Hint 2

For each protocol, explain the commit rule precisely—this is where safety comes from

Hint 3

Consider what happens when two nodes both think they're the leader; how does each protocol prevent split-brain?

Hint 4

Think about what makes a system 'debuggable' in production: deterministic behavior, introspectable state, predictable recovery