liveBook · Manning

RangeAssignor

As explained in Kafka for Architects

RangeAssignor is a Kafka consumer partition assignor that orders consumers and assigns each topic's partitions sequentially in contiguous ranges.

RangeAssignor is Kafka’s default consumer partition-assignment strategy. It orders consumers by memberId, then assigns each topic’s partitions sequentially in contiguous ranges. section 4.2.9

Its topic-by-topic assignment preserves partition-index alignment across topics when those topics have matching partition counts. Records sharing a key can therefore remain on the same consumer across related topics. section 4.2.9

Correlating invoices and profiles

An application consumes Invoices and Profiles and needs each customer’s records processed by one consumer instance. Sending both topics’ records with the customer identifier as the key routes corresponding records to the same partition index, allowing RangeAssignor to place them together. section 4.2.9

Choose RangeAssignor with these architectural consequences in mind:

  • It supports co-partitioned processing across topics when partition counts and keying align. section 4.2.9
  • It is an eager rebalance strategy, so all consumers pause while ownership is reassigned. section 4.2.7
  • RoundRobinAssignor emphasizes even distribution, while StickyAssignor emphasizes retaining existing assignments during rebalancing. section 4.2.9
Figure 4.12 The RangeAssignor strategy
A screenshot of a computer screen

Description automatically generated

Use the assignment diagram to inspect how ordered consumers receive sequential partition ranges. section 4.2.9

How Kafka for Architects covers it

How deep it goes
Defines ordering, contiguous assignment, co-partitioning, and eager-rebalance consequences without detailing assignor implementation internals.
Examples
Uses keyed Invoices and Profiles topics to demonstrate same-customer processing on one consumer instance.
What it assumes
Assumes consumer groups, topics, partitions, partition keys, and rebalancing; explains RangeAssignor behavior directly.
What you can do after
Evaluate whether partition alignment and cross-topic correlation justify eager-rebalance downtime for a consumer group.
How it connects
Connects consumer groups, partition rebalancing, co-partitioning, RoundRobinAssignor, and StickyAssignor.

Also explained in

Compare how 2 books explain RangeAssignor →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.