Scenario 02.2.3 · Assignors: range vs round-robin vs sticky
Kafka partition assignors: range vs round-robin vs sticky
The assignor decides which member owns which partition - range blocks, round-robin interleaves, sticky minimises movement (keeps the current layout).
Run this scenario in the playgroundrange - contiguous blocks. t+0.000s
The group starts on the range assignor. Range sorts members and partitions, then hands each member a contiguous block: c1 owns p0-p1, c2 owns p2-p3. Adjacent partitions land on the same member.
Open at this step: step 1, range - contiguous blocksround-robin - interleaved. t+1.400s
Switching the assignor to roundrobin re-runs the assignment (the simulator swaps it live; real consumers need a rolling restart with the new partition.assignment.strategy). Round-robin deals partitions one at a time across the sorted members, so the layout INTERLEAVES: c1 owns p0 and p2, c2 owns p1 and p3 - a different partition→member map than range for the very same group and topic.
Open at this step: step 2, round-robin - interleavedsticky - keeps the current layout (zero movement). t+2.900s
Switching to sticky re-runs the assignment, but sticky is seeded with each member's CURRENT ownership and minimises movement - so it KEEPS the round-robin layout it inherited: c1 still owns p0 and p2, c2 still owns p1 and p3. Zero partitions move. That is sticky's whole point (see 02.2.2 / 02.2.4): unlike range/round-robin, which lay a fixed layout from scratch, sticky moves as few partitions as possible - here, none.
Open at this step: step 3, sticky - keeps the current layout (zero movement)What you start with
The partition assignor is the strategy the group's leader consumer runs (client side, in the classic protocol) to map partitions to members. This scenario switches the assignor live on the same group to compare them - range hands out contiguous blocks, round-robin interleaves one at a time, and sticky minimises movement by keeping each member on the partitions it already owns.
Step by step
- range - contiguous blocks t+0.000s The group starts on the range assignor. Range sorts members and partitions, then hands each member a contiguous block: c1 owns p0-p1, c2 owns p2-p3. Adjacent partitions land on the same member. Open at this step: step 1, range - contiguous blocks
- round-robin - interleaved t+1.400s Switching the assignor to roundrobin re-runs the assignment (the simulator swaps it live; real consumers need a rolling restart with the new partition.assignment.strategy). Round-robin deals partitions one at a time across the sorted members, so the layout INTERLEAVES: c1 owns p0 and p2, c2 owns p1 and p3 - a different partition→member map than range for the very same group and topic. Open at this step: step 2, round-robin - interleaved
- sticky - keeps the current layout (zero movement) t+2.900s Switching to sticky re-runs the assignment, but sticky is seeded with each member's CURRENT ownership and minimises movement - so it KEEPS the round-robin layout it inherited: c1 still owns p0 and p2, c2 still owns p1 and p3. Zero partitions move. That is sticky's whole point (see 02.2.2 / 02.2.4): unlike range/round-robin, which lay a fixed layout from scratch, sticky moves as few partitions as possible - here, none. Open at this step: step 3, sticky - keeps the current layout (zero movement)
The takeaway
The assignor shapes balance and churn: range and round-robin lay a fixed layout from scratch (blocks vs interleaved), while sticky is seeded with current ownership and moves as few partitions as it can - here it retains the round-robin layout with zero reshuffling.
Configs in this scenario
-
partition.The assignors a classic-protocol consumer supports, in order of preference; the default [RangeAssignor, CooperativeStickyAssignor] assigns by range, and CooperativeStickyAssignor moves only the partitions that change owner instead of revoking every partition on each rebalance.assignment. strategy
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=02.2.3" title="Kafka Simulator: Assignors: range vs round-robin vs sticky" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/assignors-range-roundrobin-sticky/">Kafka partition assignors: range vs round-robin vs sticky</a></p> Further reading
More in Consumer groups
- Kafka consumer poll loop: subscribe, poll, fetch
- Kafka auto.offset.reset: earliest vs latest vs none
- Kafka committed offsets: enable.auto.commit and restart
- Replay a Kafka topic: consumed records stay in the log
- Kafka consumer group: how partitions split across members
- Kafka consumer group rebalance when a consumer joins
- Kafka eager vs cooperative rebalancing (cooperative-sticky)
- Kafka consumer crash and session.timeout.ms
- Kafka max.poll.interval.ms: evicting a stuck consumer
- Kafka static membership: group.instance.id avoids rebalances
- Kafka consumer lag: why it grows and how it drains
- Evicted Kafka consumer: how a survivor takes its partition