An In-Sync Replica (ISR) in Apache Kafka is a dynamic subset of follower replicas that are fully caught up with the partition leader. [1, 2]
How ISR Works
- Leader and Followers: Each partition has one leader handling reads and writes, and multiple followers that pull data from the leader. [1, 3]
- Dynamic Membership: If a follower falls too far behind or stops sending fetch requests within a set timeframe (
replica.lag.time.max.ms), Kafka removes it from the ISR. Once it catches up, it rejoins. [3, 4, 5] - Committed Messages: A message is considered committed only after it has been successfully written to all members of the ISR. [2, 6]
- Leader Election: Only replicas inside the ISR are eligible to be elected as the new leader if the current leader fails, ensuring no committed data is lost. [2, 7]
Key Configurations
min.insync.replicas: Defines the minimum number of ISR members required for a write to succeed when a producer setsacks=all. Most users on Stack Overflow agree that users cannot manually force a specific ISR list size; Kafka manages it dynamically based on replica performance andmin.insync.replicas. [8, 9]unclean.leader.election.enable: Determines whether a non-ISR replica can become leader if all ISR members fail, trading data consistency for availability. [3]
If you want, tell me:
- Are you troubleshooting an under-replicated partition or ISR shrinking issue?
- Do you need help tuning specific producer acks or lag configurations?
[1] https://www.geeksforgeeks.org
[5] https://codefarm0.medium.com