Apache Kafka
Replication, ISR & Durability
Survive broker failures without losing committed data.
Each partition is replicated across several brokers, set by the replication factor. One replica is the leader (serves all reads and writes); the rest are followers that continuously fetch from the leader. The set of replicas that are fully caught up is the In-Sync Replica (ISR) set.
A document signed in triplicate kept in three different offices. A change is only "official" once at least two offices hold the updated copy, so losing one office never loses the record.
Key Concepts
1
A write is considered committed once all members of the ISR have it (when acks=all). If the leader fails, the controller promotes an in-sync follower, so no acknowledged data is lost. The min.insync.replicas setting defines how many replicas must acknowledge before a write succeeds; combined with acks=all it is the core durability guarantee.
2
There is a deliberate trade-off: requiring more in-sync replicas increases durability but reduces availability for writes if replicas fall behind or go offline.
3
What the interviewer is probing.
What the interviewer is probing.
4
1. "What is the ISR?" *Probing:* the core concept. *Stalls:* "The replicas." *Moves up:* the set
of replicas caught up with the leader — only they are eligible to become leader without data loss.
1. "What is the ISR?"
5
2. "What does min.insync.replicas control?" *Probing:* the key setting. *Stalls:* "Replicas."
*Moves up:* how many must acknowledge for an acks=all write to succeed — below it the producer gets
an error rather than silently weaker durability.
2. "What does min.insync.replicas control?"
6
3. "What is unclean leader election?" *Probing:* the trade. *Stalls:* "A failure." *Moves up:*
promoting an out-of-sync replica to keep the topic available, at the cost of losing the records it
never received.
3. "What is unclean leader election?"
7
4. "What replication factor would you choose and why?" *Probing:* the practical answer.
*Stalls:* "Two." *Moves up:* three with min.insync.replicas of two, so one broker can be lost
without either data loss or a write outage.
4. "What replication factor would you choose and why?"