0
0
Kafkadevops~10 mins

In-sync replicas (ISR) in Kafka - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - In-sync replicas (ISR)
Leader receives write request
Leader writes to local log
Leader sends data to followers
Followers append data to their logs
Followers send acknowledgment
Leader updates ISR list
Leader commits message if ISR quorum
Next write request
This flow shows how the leader and followers keep data in sync by exchanging writes and acknowledgments to maintain the ISR list.
Execution Sample
Kafka
Leader receives write
Leader writes locally
Leader sends to followers
Followers append and ack
Leader updates ISR
Leader commits message
Shows the step-by-step process of how replicas stay in sync and how the ISR list is updated.
Process Table
StepActionLeader LogFollower LogsISR ListCommit Status
1Leader receives write request[][][]No
2Leader writes data locally[msg1][][]No
3Leader sends data to followers[msg1][][]No
4Followers append data and ack[msg1][msg1][]No
5Leader updates ISR list[msg1][msg1][Leader, Follower1]No
6Leader commits message (quorum ack)[msg1][msg1][Leader, Follower1]Yes
7Next write request arrives[msg1][msg1][Leader, Follower1]Yes
💡 Process stops here waiting for next write or follower lag
Status Tracker
VariableStartAfter Step 2After Step 4After Step 5After Step 6
Leader Log[][msg1][msg1][msg1][msg1]
Follower Logs[][][msg1][msg1][msg1]
ISR List[][][][Leader, Follower1][Leader, Follower1]
Commit StatusNoNoNoNoYes
Key Moments - 2 Insights
Why does the ISR list update only after followers acknowledge?
Because the ISR list includes only replicas that have confirmed they have the latest data, as shown in step 5 where ISR updates after follower acks in step 4.
What happens if a follower does not acknowledge in time?
The follower is removed from the ISR list, so the leader will not wait for its ack to commit messages, ensuring availability (not shown in this trace but implied after step 5).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the leader commit the message?
AStep 4
BStep 6
CStep 5
DStep 7
💡 Hint
Check the 'Commit Status' column in the execution table where it changes to 'Yes'.
At which step do followers append the message to their logs?
AStep 4
BStep 2
CStep 3
DStep 5
💡 Hint
Look at the 'Follower Logs' column where it changes from empty to '[msg1]'.
If a follower fails to acknowledge, how would the ISR list change after step 5?
AISR list would be empty
BISR list would include all replicas
CISR list would exclude the non-acknowledging follower
DISR list would not change
💡 Hint
Refer to the key moment about follower acknowledgments affecting ISR list.
Concept Snapshot
In-sync replicas (ISR) track replicas that have fully caught up with the leader.
Leader writes data locally, sends to followers.
Followers append data and send acknowledgments.
Leader updates ISR list with replicas that acked.
Leader commits messages once ISR quorum is reached.
ISR ensures data durability and availability.
Full Transcript
This visual trace shows how Kafka's In-sync replicas (ISR) mechanism works. The leader receives a write request and writes the data to its local log. Then it sends the data to follower replicas. Followers append the data to their logs and send acknowledgments back to the leader. Once the leader receives acknowledgments from followers, it updates the ISR list to include those replicas. When a quorum of ISR members have acknowledged, the leader commits the message, making it durable. If a follower does not acknowledge in time, it is removed from the ISR list to maintain availability. This process repeats for each new write request, ensuring data consistency and fault tolerance.