Leader and Follower
In this tutorial, we are going to explore about the Leader and Follower patterns and its usage in distributed systems. The terms Leader and Follower are widely used in different contexts, including distributed systems, organizational management, and social dynamics.
Background
Distributed systems keep multiple copies of data for fault tolerance and higher availability. A system can use quorum to ensure data consistency between replicas, i.e., all reads and writes are not considered successful until a majority of nodes participate in the operation. However, using quorum can lead to another problem, that is, lower availability; at any time, the system needs to ensure that at least a majority of replicas are up and available, otherwise the operation will fail. Quorum is also not sufficient, as in certain failure scenarios, the client can still see inconsistent data.
Solution
Allow only a single server (called leader) to be responsible for data replication and to coordinate work.
At any time, one server is elected as the leader. This leader becomes responsible for data replication and can act as the central point for all coordination. The followers only accept writes from the leader and serve as a backup. In case the leader fails, one of the followers can become the leader. In some cases, the follower can serve read requests for load balancing.

Leader
- A Leader is a designated node or component in a distributed system responsible for coordinating activities, making decisions, or managing resources.
- It ensures that the system operates consistently and efficiently by handling critical tasks like:
- Coordinating writes or updates.
- Deciding on cluster configurations.
- Assigning tasks to other nodes (followers).
Follower
- A Follower is a node or component that takes instructions from the leader and carries out the assigned tasks.
- Followers replicate data, listen for updates, and ensure high availability.
Leader and Follower Communication
- Leaders broadcast updates to followers.
- Followers acknowledge these updates and may provide feedback (e.g., error reports or status).
Examples in Distributed Systems
- Consensus Algorithms:
- In Raft or Paxos, the leader is elected to coordinate and propose log entries, while followers accept or reject proposals.
- Databases:
- In PostgreSQL streaming replication, the primary node is the leader, and replicas are followers.
- Messaging Systems:
- In Apache Kafka, the leader of a partition handles reads and writes, while replicas (followers) sync data for fault tolerance.
Key Takeaways
- Leader: Guides, makes decisions, and coordinates.
- Follower: Executes tasks and provides feedback.
- The leader-follower model ensures efficiency, consistency, and reliability in both technical systems and human dynamics.
That’s all about the Leader and Follower. If you have any queries or feedback, please write us at contact@waytoeasylearn.com. Enjoy learning, Enjoy system design interview series..!!