Dima Statz
1 min readSep 15, 2019

--

Thanks, Mark.

I didn’t see any problem with message distribution between partitions. By default, when message key is not specified, Kafka producers are using Round-Robin strategy. In this case, all messages will be distributed evenly between partitions.

Another approach is to specify the message key in code. https://kafka.apache.org/10/javadoc/org/apache/kafka/clients/producer/ProducerRecord.html#ProducerRecord-java.lang.String-K-V-

In this case, the partition is picked by using the following formula: partition = messageKey.hashCode % numOfPartitions

and it will be a developer’s responsibility to pick the key properly.

--

--

No responses yet