Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. One line is not enough
  2. 2. Partitions, offsets and consumer groups
  3. 3. Four partitions, one hot key, one rebalance
  4. 4. When one partition cannot keep up
  5. 5. How many partitions to create
  6. 6. Where the commit goes decides the guarantee
  7. 7. Owners, order and commits: three checks

Topic 3

Four partitions, one hot key, one rebalance

7 min read

A group reading four partitions

The lab starts with four partitions, four consumers and no hot key. Each row is a partition, with its owner and its lag. Below them each consumer shows which partitions it holds. The buttons add a consumer, remove one, or rewind every partition to the oldest message the log still keeps. The counters show two kinds of order break. A same-key break would mean a bug. A cross-key break is normal.

Predict before you press play

Send half of all messages with one single key, then raise the number of consumers to 12. What happens to the lag on the partition that holds that key?

4 consumers, 4 partitionsworking consumers = min(C, P) = 4Group drains at most 6.0 messages per tick, if every partition has work.

Last event: group formed.

Partitions: lag is the gap between the end of the log and the consumer

  • P0C10
  • P1C20
  • P2C30
  • P3C40

Bars share one scale. A star marks the partition that holds the hot key. Lag is counted from the consumer's position; tools usually count from the committed offset, which trails by up to one commit interval.

Consumers in the group

  • C1P0122 done
  • C2P189 done
  • C3P297 done
  • C4P392 done
produced
400
total lag
0
worst partition lag
0
hot key partition share
24%
same-key order breaks
0
cross-key order breaks
193
re-read after rebalance or replay
0
rebalances
00 ticks paused
Lag over time
Lag over time. Text version available below the chart.01345tick 5tick 55tick 100ticksmessages behind

Full-page version with guided experiments: Partitioned log lab.

Things to try

  1. Leave the defaults and watch the two order counters. Same-key breaks stay at zero. Cross-key breaks keep rising.
  2. Raise the starting consumers above the number of partitions. The extra consumers show as idle.
  3. Give half the messages to one key. One partition’s lag climbs while the others stay empty.
  4. Press “A consumer leaves” and watch the status line and the lag chart. Then try a longer rebalance pause.
  5. Press “Replay from the earliest offset” and watch the re-read counter. Order stays intact.

The full-page lab has five guided experiments you can apply with one click.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms