liveBook · Manning

RangeAssignor

As explained in Apache Kafka in Action

The Range Assignor is a Kafka partition-assignment algorithm that assigns corresponding partition numbers from subscribed topics to the same consumers.

RangeAssignor is Kafka’s default partition-assignment strategy. During a consumer-group rebalance, the group leader assigns corresponding partition numbers from subscribed topics to the same consumer. All consumers in the group must use the same strategy to avoid unpredictable assignments, inconsistent processing, and performance problems. section 9.4.2

Aligning partitions for a stream join

With products.prices.changelog and products.sales, each having two partitions, and three consumers, Consumer 1 receives Partition 0 from both topics, Consumer 2 receives Partition 1 from both, and Consumer 3 receives nothing. If both topics use the product name as their key, matching products land in matching partitions, making the data easy to join. Use Kafka Streams rather than implementing a naive join directly in a consumer. section 9.4.2

Figure 9.5 By default, partitions in a consumer group are assigned in such a way that the same partition across different topics is always consumed by the same consumer. While this may not be the most resource-efficient allocation, it allows us to easily perform joins across multiple topics.
A screenshot of a computer screen

AI-generated content may be incorrect.

Compare aligned cross-topic assignments with more evenly distributed alternatives and see why alignment can simplify joins while leaving some consumers idle. section 9.4.2

How Apache Kafka in Action covers it

How deep it goes
Explains default behavior, rebalance leadership, configuration consistency, partition examples, join use, and the risk of idle consumers.
Examples
Uses two two-partition product topics, three consumers, matching product keys, and a Kafka Streams join scenario.
What it assumes
Assumes Kafka consumer groups, topics, partitions, consumers, keys, and rebalances; introduces their interaction through assignment behavior.
What you can do after
Evaluate cross-topic processing needs, configure a consistent assignment strategy, and choose Kafka Streams for joins.
How it connects
Connects consumer groups, rebalances, partition assignment strategies, stream joins, Kafka Streams, and the Round Robin Assignor.

Also explained in

Compare how 2 books explain RangeAssignor →

Related concepts

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