Distributed event streaming platform engineered for high performance, scalability, and durability.
Producers to send messages to topics, and consumers to read them, with messages being stored in ordered, immutable partitions across multiple brokers (servers).
Highly suited for real-time data processing and asynchronous message queuing in system design.
To ensure durability and availability through robust replication mechanism.
Leader Replica Assignment
Each partition has a designated leader replica, which resides on a broker.
This leader replica is responsible for handling all read and write requests for the partition.
The assignment of the leader replica is managed centrally by the cluster controller, which ensures that each partition’s leader replica is effectively distributed across the cluster to balance the load.
Follower Replication
Several follower replicas exist for each partition, residing on different brokers.
Do not handle direct client requests.
Passively replicate the data from the leader replica.
Act as backups, ready to take over when the leader replica fail.
Synchronization and Consistency
Followers continuously sync with the leader replica to ensure they have the latest set of messages appended to the partition log.
Is crucial for maintaining consistency across the cluster.
If the leader replica fails, one of the follower replicas that has been fully synced can be quickly promoted to be the new leader, minimizing downtime and data loss.
Controller's Role in Replication
The controller within the Kafka cluster manages this replication process
monitors the health of all brokers and manages the leadership and replication dynamics.
When a broker fails, the controller reassigns the leader role to one of the in-sync follower replicas to ensure continued availability of the partition.