What is the ISR (In-Sync Replicas) in Kafka?
The In-Sync Replicas (ISR) list is a dynamic set maintained per partition by the Kafka broker acting as partition leader. A replica is considered "in-sync" if it has fetched all messages from the leader within the window defined by `replica.lag.time.max.ms` (default 30s). If a follower falls behind — due to network issues, GC pauses, or slow disk — it is removed from the ISR.
The ISR is critical for durability guarantees. When a producer sends with `acks=all` (or `acks=-1`), the leader waits until every replica in the current ISR has acknowledged the message before returning success to the producer. This means ISR shrinkage directly impacts write latency — a slow replica that stays in ISR causes the producer to wait for it.
During leader election, Kafka by default only allows replicas in the ISR to be elected as the new leader. This prevents data loss: a non-ISR replica may be missing messages the previous leader had already acknowledged. The `unclean.leader.election.enable` setting (default false) controls whether out-of-ISR replicas can be elected — enabling it trades consistency for availability.
Operationally, you can inspect ISR status via `kafka-topics.sh --describe` or through broker metrics (`UnderReplicatedPartitions`, `IsrShrinksPerSec`). A consistently shrinking ISR is a leading indicator of broker health issues and should trigger investigation before it affects availability.
The interplay between ISR, `min.insync.replicas`, and `acks` defines your actual durability contract. ISR is the mechanism; the other two settings are the policy knobs that tell Kafka how to enforce that contract under degraded conditions.
Defines ISR as replicas caught up to the leader and connects it to `acks=all` semantics. Mentions that slow replicas fall out of ISR.
Explains the `replica.lag.time.max.ms` threshold, the implication for leader election (only ISR replicas eligible by default), and the operational signal of ISR shrinkage. Connects ISR to the broader durability contract with `min.insync.replicas`.
Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.
Get Graded — Free Assessment