Video in progress

Strong Middle 📨 Kafka and messaging

What is the ISR, and when does a replica drop out of it?

The ISR is the list of replicas considered in sync with the leader. If a follower doesn't catch up to the leader's end within replica.lag.time.max.ms (30s by default), it's removed from the ISR.

📖 Answer

Each partition has one leader and several followers. Followers keep fetching from the leader. The leader tracks when each follower last fully caught up; if that time exceeds replica.lag.time.max.ms, the follower is removed from the ISR. The old "lag by number of messages" setting from earlier versions was removed; now only time counts.

Typical causes:

  • a GC pause or slow disk on the broker;
  • a network problem, cross-AZ traffic congestion;
  • after a broker restart, it has to catch up on a lot of data.

Why this matters: the high watermark only advances to the offset that exists on every replica in the ISR, and consumers read only up to the HW. If the ISR shrinks, acks=all writes rely on fewer replicas.

Metrics to watch:

kafka.server:type=ReplicaManager,name=UnderReplicatedPartitions
kafka.server:type=ReplicaManager,name=IsrShrinksPerSec

If UnderReplicatedPartitions > 0 for a long time, alert. If the ISR keeps shrinking and expanding (flapping), the broker usually doesn't have enough resources.