Monedula

Scenario 02.2.3 · Assignors: range vs round-robin vs sticky

Kafka partition assignors: range vs round-robin vs sticky

Consumer groups · Advanced · about 3 min · Apache Kafka 4.3

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 playground

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)

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

  1. 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
  2. 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
  3. 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

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

Apache Kafka documentation

More in Consumer groups

All scenarios