SYSTEM-DESIGN
    advanced

    Kafka Consumer Group Rebalancing

    Software Engineer path · lesson 83 of 99
    parallelism 2/6
    Topic: orders · 6 partitions
    P0
    P1
    P2
    P3
    P4
    P5
    Consumer Group: order-service
    Consumer C1
    P0
    P1
    P2
    Consumer C2
    P3
    P4
    P5
    Rebalance Log
    Add or remove consumers to trigger a rebalance…

    Key insight

    Each partition is owned by exactly one consumer, so throughput scales only up to min⁡(consumers,partitions)\min(\text{consumers}, \text{partitions}). With 6 partitions, the group can still add consumers (up to 6) to parallelize further. Every membership change forces a rebalance — cheap here, but a stop-the-world event in production, which is why the CooperativeStickyAssignor exists.

    Range assignment

    Sort

    Seven partitions, three consumers, Range assignor. Sort each partition to its consumer.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Consumer 1

    Drop items here

    Consumer 2

    Drop items here

    Consumer 3

    Drop items here
    7 pieces left to place

    Test your knowledge

    21 questions
    Question 1 of 21
    Score: 0

    What caps the maximum consumer parallelism in a group?

    The short version

    A consumer group is like a team splitting a stack of mailboxes (partitions): every mailbox is checked by exactly one teammate. Add a teammate and the mailboxes are redealt; if there are more teammates than mailboxes, the extras stand idle.

    In more depth

    Consumer Group Rebalancing

    Within a consumer group, each partition is consumed by exactly one consumer. The group coordinator computes the assignment, and any membership change (join, leave, or session timeout) triggers a rebalance.

    Parallelism ceiling

    Throughput scales only up to min(consumers, partitions) — extra consumers are idle.

    Assignors

    Range (default): contiguous partition ranges per topic; can skew load.
    RoundRobin: spreads partitions evenly one-by-one.
    CooperativeSticky: incremental rebalances that avoid stop-the-world by only revoking partitions that must move.

    Interview Questions

    Confluent
    LinkedIn
    Uber
    Confluent
    Netflix
    Uber
    Datadog
    Twitter/X
    Stripe

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required