Skill Zuno · skillzunos.com · System Design
Leader Election interview questions
Prepare for Leader Election interviews on Skill Zuno. This practice book covers Leader Election interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open Leader Election on Skill ZunoAlso see the Leader Election tutorial.
Leader election chooses one node in a cluster to coordinate work, such as accepting writes or running scheduled jobs, so that nodes do not conflict. It must cope with crashes, slow nodes and network partitions without ever producing two leaders at once. Interviews cover why leaders are needed, Raft and Paxos, leases, fencing tokens and tools such as ZooKeeper and etcd.
Sample Leader Election interview questions
What is split brain?
A partition leaves two groups of nodes that each believe they have a leader, so both accept writes and data diverges. Requiring a majority quorum means only one side can elect a leader.
How does Raft elect a leader?
Followers expect heartbeats. If one times out, it becomes a candidate, increments the term and asks for votes; a candidate with votes from a majority becomes leader. Randomised timeouts make split votes rare.
Why do clusters usually have an odd number of nodes?
A majority of 5 is 3, which tolerates 2 failures, and a majority of 6 is 4, which still tolerates only 2. The extra even node adds cost without adding fault tolerance.
What is a fencing token?
A number that increases each time leadership changes. Storage rejects requests with an older token, so a paused former leader that wakes up cannot overwrite the new leader's work.
Should you implement your own consensus algorithm?
Almost never. Consensus is subtle and easy to get wrong. Use etcd, ZooKeeper or Consul, or a database's built-in replication, for leader election.
What you can practice
- Leader Election interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- System Design topics alongside Leader Election on skillzunos.com