Replication — ISR is not a quorum
A write is committed when every replica currently in the In-Sync Replica set has fetched it — and ISR is mutable, so a slow follower is evicted rather than blocking the high water mark.
Each partition lives on multiple brokers. The question is: when is a write safe enough to acknowledge? Kafka's answer is the In-Sync Replica set — and it's a moving target, not a fixed quorum vote.
Scene 04
Replication — ISR is not a quorum
- Watch
- Try it
- Predict
- Capture
Watch the producer append records to the leader. Both followers fetch and their LEOs catch up. The leader's High Water Mark — the offset consumers can read — slides up to the slowest in-ISR follower's LEO, never past it.
Highlighted lines are the ones running in the diagram right now.
loop forever:resp = leader.fetch(partition = p,fromOffset = self.leo,)for record in resp.records:self.log.append(record)self.leo += 1# tells the leader 'I have everything up to leo'leader.recordFetchPosition(self.id, self.leo)sleep(replica.fetch.backoff.ms)
def tryAdvanceHW():# ISR is the set of replicas currently caught up.# 'all' here means all of THESE, not all RF.inSyncLEOs = [leo for replicaId, leo in fetchPositions.items()if replicaId in ISR]newHW = min(inSyncLEOs)if newHW > self.hw:self.hw = newHWnotifyConsumers(self.hw) # records become readable
# runs continuously on the leaderdef maybeShrinkISR():for replicaId in list(ISR):lastFetch = fetchTimestamps[replicaId]if now() - lastFetch > replica.lag.time.max.ms:ISR.remove(replicaId)controller.notifyISRShrink(partition, ISR,)# HW recomputed against the smaller settryAdvanceHW()
Where this sits in Build Kafka
Scene 04 of 13, in the Write side act — Partitioning, replication, and durability knobs.. Why a write commits when the in-sync set fetches it, not a majority.
Up next. Cluster, controller, and metadata — many brokers and many replicas need a coordinator. One broker at a time is the controller, and in KRaft mode the metadata itself is a Raft log.
Designs that use this
- Twitter / X TimelinePush or pull? Both. The canonical fanout problem.
- Uber / Lyft — Match Drivers and RidersMatch a rider to the closest acceptable driver in under 3 s. Geohash, S2, surge.
- Slack / DiscordChannels and history. Push or pull — and how a hot-channel fanout doesn't melt the gateway.
- WhatsApp / MessengerHundreds of millions of long-lived sockets, sub-second 1:1 + group delivery, E2E-encrypted, multi-device, multi-region active-active.