---
title: "Kafka ISR (in-sync replicas): how replicas leave and rejoin"
description: "A broker dies and the Kafka ISR shrinks from {1,2,3} to {1,2}. Writes still commit at min.insync.replicas=2, then the broker restarts, back-fills and rejoins."
url: https://monedula.dev/kafka-simulator/scenarios/the-isr-set/
---

# Kafka ISR (in-sync replicas): how replicas leave and rejoin

Scenario 03.1.1 · The ISR set. Replication · Intermediate · about 2 min · Apache Kafka 4.3.

The in-sync replica set is every replica keeping up with the leader. Replicas leave it when they die or lag, and rejoin when they catch up.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=03.1.1

## What you start with

The in-sync replica set (ISR) is every replica currently caught up to the leader - the set that acks=all and the high watermark are computed over. Here all three replicas start in-sync, broker-3 is killed so the ISR shrinks to {1,2}, a record is produced while it is gone, then it restarts, back-fills what it missed, and rejoins the ISR.

## Step by step

1. **All three replicas in-sync · ISR {1,2,3}** (t+1.200s): R1 is replicated to every broker, so all three replicas are caught up to the leader - the ISR is {1,2,3}. acks=all and the high watermark are computed over this set. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.1.1&t=0)
2. **broker-3 dies · ISR shrinks to {1,2}** (t+3.200s): broker-3 was killed, so it can no longer be in-sync - the controller fences it and removes it from the ISR, now {1,2}. That still meets min.insync.replicas=2, so the partition keeps accepting acks=all writes. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.1.1&t=1)
3. **Writes continue on the surviving ISR** (t+6.000s): R2 is produced and commits on the two surviving in-sync replicas (HW advances to 2). broker-3, still down, holds only the older R1. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.1.1&t=2)
4. **broker-3 restarts and rejoins the ISR** (t+8.200s): broker-3 came back, fetched the record it missed (R2), caught up to the leader, and rejoined the ISR - back to {1,2,3}. ISR membership is dynamic: replicas leave when they die or lag and rejoin when they catch up. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=03.1.1&t=3)

## The takeaway

ISR membership is dynamic: a replica drops out when it dies or lags and rejoins once it catches back up - the ISR is always the live picture of which copies are durable.

## Configs in this scenario

- [`acks`](https://kafka.apache.org/43/configuration/producer-configs/#producerconfigs_acks): How many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). [How acks works](https://monedula.dev/kafka-simulator/configs/acks/)
- [`min.insync.replicas`](https://kafka.apache.org/43/configuration/topic-configs/#topicconfigs_min.insync.replicas): The fewest in-sync replicas, leader included, that must have a write for an acks=all produce to succeed (default 1); with fewer in the ISR the leader rejects the write with NOT_ENOUGH_REPLICAS. [How min.insync.replicas works](https://monedula.dev/kafka-simulator/configs/min-insync-replicas/)

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/43/design/design/#replication)
