Skip to content

KAFKA-19193 Support rack-aware partitioning for Kafka producer #19850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

ivanyu
Copy link
Contributor

@ivanyu ivanyu commented May 29, 2025

According to KIP-1123, this commit adds the support for rack-aware partitioning to BuiltInPartitioner. It comes with two new configs for the producer: partitioner.rack.aware and client.rack, which allows enabling the new behavior.

Apart from the added unit tests, the desired behavior was tested by kafka-producer-perf-test.sh with an existing and a non-existing rack against a 4 node cluster with two racks and 12-partition topic:

./kafka_2.13-4.1.0-SNAPSHOT/bin/kafka-producer-perf-test.sh \
  --topic test-topic --num-records 100000 --throughput -1 --record-size 1 \
  --producer-props bootstrap.servers=127.0.0.1:9092 \
  client.rack=rack0 partitioner.rack.aware=true

Delete this text and replace it with a detailed description of your change. The
PR title and body will become the squashed commit message.

If you would like to tag individuals, add some commentary, upload images, or
include other supplemental information that should not be part of the eventual
commit message, please use a separate comment.

If applicable, please include a summary of the testing strategy (including
rationale) for the proposed change. Unit and/or integration tests are expected
for any behavior change and system tests should be considered for larger
changes.

@github-actions github-actions bot added triage PRs from the community producer clients labels May 29, 2025
@ivanyu ivanyu force-pushed the kip-1123-rack-aware-partitioning branch 10 times, most recently from 2690433 to 1af9189 Compare May 31, 2025 06:12
According to KIP-1123, this commit adds the support for rack-aware partitioning to `BuiltInPartitioner`. It comes with two new configs for the producer: `partitioner.rack.aware` and `client.rack`, which allows enabling the new behavior.

Apart from the added unit tests, the desired behavior was validated by `kafka-producer-perf-test.sh` with an existing and a non-existing rack against a 4 node cluster with two racks and 12-partition topic:
```shell
./kafka_2.13-4.1.0-SNAPSHOT/bin/kafka-producer-perf-test.sh \
  --topic test-topic --num-records 100000 --throughput -1 --record-size 1 \
  --producer-props bootstrap.servers=127.0.0.1:9092 \
  client.rack=rack0 partitioner.rack.aware=true
```
@ivanyu ivanyu force-pushed the kip-1123-rack-aware-partitioning branch from 1af9189 to 564e60f Compare May 31, 2025 06:14
@ivanyu ivanyu marked this pull request as ready for review May 31, 2025 06:20
Copy link

github-actions bot commented Jun 6, 2025

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant