THIS EXPLANATION
THE ROOM
CDA·266 Computing, Data & AI 6 MIN · 8 STATIONS

Why adding a worker stops the others

A Socratic walk-through of why adding a worker stops the others — reasoned out one step at a time, not lectured.

abcdefgh
a

The question we started with

THE QUESTION #

Why does bringing another consumer online briefly halt every consumer already running?

You are behind on a stream, so you start one more consumer. The sensible expectation is that throughput rises, perhaps after a moment while the newcomer warms up. What the dashboards show instead is every consumer — including the healthy ones that were never going to be touched — stopping together for a second or several, and lag briefly getting worse.

Nothing failed. You added capacity and the system paused. That is odd enough to be worth explaining rather than tolerating, especially since the same pause happens on every deploy, every restart, and every time a consumer is momentarily slow.

b

Reasoning it through

REASONING #

Ask first what invariant the group is protecting. Each partition must be read by exactly one consumer in the group at a time. Not "usually one" — exactly one, because two readers on one partition would process the same records twice, commit conflicting positions, and destroy the per-partition ordering that is the whole reason partitions exist.

Now suppose membership changes. Someone must compute a new assignment, and every member must adopt it. What could go wrong during the changeover? If one consumer adopts the new plan while another is still acting on the old one, some partition is briefly owned by two of them. The invariant breaks in exactly the window where nobody is watching.

So how do you guarantee no overlap? The cheapest correct answer — cheap in reasoning, expensive in downtime — is a barrier: everybody lets go first, then everybody picks up. If no member holds anything at the moment the new plan is computed, no two members can hold the same thing afterwards. That is the eager rebalance protocol, and it explains the symptom precisely. Consumption stops group-wide because stopping group-wide is the proof of correctness.

Trace the states and it becomes concrete. A coordinator on one broker watches the group. A join, a departure, or a member that misses its heartbeat moves the group out of stable and into preparing to rebalance; every member must revoke its partitions and rejoin. Once all have rejoined — or the join window expires on the stragglers — an assignment is computed and distributed, and the group returns to stable. During the middle two states nothing is being consumed by anyone.

Which raises the sharper question: was the barrier necessary? Not entirely. Notice that most partitions are not moving. If a group of four gains a fifth member, the majority of assignments are unchanged, and revoking them was pure waste. The cooperative incremental protocol, introduced in Kafka 2.4 under KIP-429, exploits exactly that: members keep the partitions they are retaining and revoke only the ones being reassigned, at the cost of a second rebalance round to hand them over safely. Later work moves assignment computation to the broker itself and removes the group-wide synchronization barrier; that newer consumer group protocol, KIP-848, reached general availability in Kafka 4.0.

There is one more thing worth noticing, because it turns an inconvenience into an incident. Rebalances are triggered by more than deliberate scaling. A consumer whose processing loop takes longer than its allowed poll interval is treated as gone, which triggers a rebalance, which pauses everyone, which makes everyone further behind, which makes the next batch slower, which can evict another member. The loop is self-reinforcing. It is why a group can appear to be "constantly rebalancing" without anyone having deployed anything.

c

The analogy

THE ANALOGY #
THE FIGURE

Picture a sorting office where each clerk is assigned certain postcodes, and the rule is absolute: no letter may be handled by two clerks, because they would both stamp it. A new clerk arrives. Rather than negotiate the boundaries one at a time, the supervisor blows a whistle, everyone puts down every bundle and steps back from the tables, the new rota is read out, and only then does work resume. The office is idle for the length of the announcement even though most clerks end up with the same postcodes they had before.

WHERE IT BREAKS DOWN

the clerks can see each other, so a real supervisor could simply walk over and reassign two postcodes without stopping the room. Consumers cannot observe one another at all — they only know what the coordinator tells them, and messages between them and the coordinator can be delayed or lost — so the whistle is standing in for the certainty that a shared room gives away for free.

d

Clarifying the model

THE MODEL #

The misconception to correct is that the pause is a warm-up cost belonging to the joining consumer. It is not; it is a coordination cost belonging to the group, and it is paid in full even when the newcomer is instantly ready and even when its share of the work is tiny.

That reframing changes what you tune. Since the cost scales with the number of membership changes rather than their size, the useful moves are the ones that reduce how often membership appears to change: giving each instance a stable identity so a rolling restart does not look like a departure and an arrival, sizing the poll interval against your genuine worst-case processing time rather than the average, and starting several new consumers together rather than one every few minutes.

One qualification, since the newer protocols are easy to over-read. Cooperative rebalancing removes the group-wide stop, not the rebalance. Partitions that genuinely change hands still pause, and their new owner may still have local state to restore before it can process. What was eliminated is the collateral damage to consumers whose assignment never changed — which was most of the pain, but not all of it.

e

A picture of it

THE PICTURE #
Why adding a worker stops the others
Why adding a worker stops the others The group occupies one state at a time. Read the loop clockwise from stable: any membership event at all -- deliberate or accidental -- drops the whole group into the revoked state, and consumption resumes only when the cycle completes back at stable. The self-transition on the middle state is the pathological case, where a member too slow to rejoin restarts the cycle before it finishes, which is how a group ends up rebalancing continuously without anyone changing anything. {"generator":"mermaid-svg-renderer@3.2.1","source":"../Socrates/.diagram-cache/_src/why-adding-a-worker-stops-the-others.md","sourceIndex":1,"sourceLine":4,"sourceHash":"912619a545c652750abc0712317772651a81186529850e7657f13746b7fd96b9","diagramType":"stateDiagram","layoutVariant":"source","repairedDuplicateIds":[],"motion":"entrance-with-reduced-motion-fallback","presentation":"editorial","attempt":1,"viewBox":{"x":0,"y":0,"width":822,"height":857},"qa":{"passed":true,"findings":[]}} a member joins, leaves ormisses a heartbeat every member hasrejoined assignment delivered andaccepted a slow member is evictedmid rebalance Stable: every member owns afixed set PreparingRebalance: allpartitions revoked CompletingRebalance: awaitingthe new plan Nobody consumes here.This is the halt you see.Eager protocol only.

How to readThe group occupies one state at a time. Read the loop clockwise from stable: any membership event at all — deliberate or accidental — drops the whole group into the revoked state, and consumption resumes only when the cycle completes back at stable. The self-transition on the middle state is the pathological case, where a member too slow to rejoin restarts the cycle before it finishes, which is how a group ends up rebalancing continuously without anyone changing anything.

f

What became clearer

WHAT CLEARED #
WHAT CLEARED

The pause is not overhead attached to the new consumer; it is the price of proving that no partition is ever owned twice, using the bluntest available proof — have everyone let go before anyone picks up. Once you see it as a group-wide coordination barrier rather than a startup cost, the right responses follow: make membership changes rarer and more predictable, and prefer a protocol that only stops the partitions actually moving.

g

Where to go next

ONWARD #
  • How static membership lets a rolling restart avoid rebalancing entirely, and what it costs if an instance never comes back.
  • Why restoring a local state store can dominate rebalance time, and how standby replicas shorten it.
h

Key terms

TERMS #
TermWhat it means
Consumer groupa set of consumers that divide a topic's partitions between them, each partition going to exactly one member.
Group coordinatorthe broker that tracks group membership and drives the rebalance state machine.
Eager rebalancingthe protocol in which every member revokes every partition before a new assignment is computed.
Cooperative incremental rebalancingKIP-429's protocol, in which only reassigned partitions are revoked, over two rounds.

Every term the collection defines is gathered in the glossary.

Nearby on the shelf

4