You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Jon McEwen (Jira)" <ji...@apache.org> on 2021/10/01 07:25:01 UTC
[jira] [Commented] (KAFKA-9965) Uneven distribution with
RoundRobinPartitioner in AK 2.4+
[ https://issues.apache.org/jira/browse/KAFKA-9965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17423150#comment-17423150 ]
Jon McEwen commented on KAFKA-9965:
-----------------------------------
PR ready for review please [~showuon]
> Uneven distribution with RoundRobinPartitioner in AK 2.4+
> ---------------------------------------------------------
>
> Key: KAFKA-9965
> URL: https://issues.apache.org/jira/browse/KAFKA-9965
> Project: Kafka
> Issue Type: Bug
> Components: producer
> Affects Versions: 2.4.0, 2.5.0, 2.4.1
> Reporter: Michael Bingham
> Priority: Major
>
> {{RoundRobinPartitioner}} states that it will provide equal distribution of records across partitions. However with the enhancements made in KIP-480, it may not. In some cases, when a new batch is started, the partitioner may be called a second time for the same record:
> [https://github.com/apache/kafka/blob/2.4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L909]
> [https://github.com/apache/kafka/blob/2.4/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L934]
> Each time the partitioner is called, it increments a counter in {{RoundRobinPartitioner}}, so this can result in unequal distribution.
> Easiest fix might be to decrement the counter in {{RoundRobinPartitioner#onNewBatch}}.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)