What are In-Sync Replicas (ISR) in Kafka?

In Apache Kafka, data isย replicated across brokers for fault tolerance.

  • Each topic partition has:

    • Leader replica โ†’ handles all reads/writes.

    • Follower replicas โ†’ replicate data from the leader.

๐Ÿ‘‰ In-Sync Replicas (ISR) = the set of replicas (leader + followers) that have fully caught up with the leaderโ€™s data.

  • If a follower is lagging too much, itโ€™s removed from ISR.

  • Only ISR members are considered safe copies of the data.


๐Ÿ”น Example

Suppose you have a topic partition with replication factor = 3:

  • Broker 1 โ†’ Leader

  • Broker 2 โ†’ Follower

  • Broker 3 โ†’ Follower

If all are up-to-date, ISR = {Broker 1, Broker 2, Broker 3}.
If Broker 3 falls behind (network/disk issue), ISR = {Broker 1, Broker 2}.


๐Ÿ”น Why ISR Matters?

  • Acknowledgements:

    • If acks=all โ†’ Kafka waits for data to be written to all ISR replicas, ensuring durability.

    • If a broker is out of ISR, Kafka doesnโ€™t wait for it.

  • Leader Election:

    • If the leader fails, a new leader is chosen only from ISR to ensure no data loss.


๐Ÿ”น Configurations Related to ISR

  1. min.insync.replicas

    • Minimum number of ISR replicas required for a write to be considered successful.

    • Prevents writes if too few replicas are in sync (avoids data loss).

  2. acks (producer config)

    • acks=1 โ†’ leader only.

    • acks=all โ†’ leader + all ISR replicas.

    • acks=0 โ†’ no acknowledgement (fast but risky).


๐Ÿ”น Quick Analogy

Think of ISR like a class attendance register:

  • Leader = teacher.

  • Followers = students copying notes.

  • ISR = students who are up-to-date with the teacherโ€™s notes.

  • If a student is far behind, teacher doesnโ€™t rely on him for group work.


๐Ÿ”น In Short

In-Sync Replicas (ISR) = the set of replicas (leader + followers) that are fully caught up with the leader.

  • Used for durability, acknowledgements, and safe leader election.

  • Key configs: acks, min.insync.replicas.

Back to blog

Leave a comment