[英]Kafka Rest Proxy Api Uneven Distribution of messages
I have 2 partitions and messages in avro-format.我有 2 个分区和 avro 格式的消息。 I send the messages via kafka rest proxy api. I use the key for the messages.
我通过 kafka rest 代理 api 发送消息。我使用消息的密钥。 The key is a string.
键是一个字符串。 For example, there are my keys:
例如,有我的钥匙:
41:46-300, 41:45-300, 41:44-300, 41:43-300, 41:42-300. 41:46-300、41:45-300、41:44-300、41:43-300、41:42-300。
But the messages are uneven distributed.但是消息分布不均匀。 In the partition 0 there are messages with keys 41:46-300, 41:45-300, 41:44-300, 41:43-300 and in the partition 1 there are only messages with the key 41:42-300.
在分区 0 中,有密钥为 41:46-300、41:45-300、41:44-300、41:43-300 的消息,而在分区 1 中,只有密钥为 41:42-300 的消息。
Kafka version: 2.4卡夫卡版本:2.4
Could you explain me Why there is happened?你能解释一下为什么会这样吗?
Kafka uses Murmur2 hashing to distribute keys, not an evenly distributed round-robin mechanism. Kafka 使用 Murmur2 哈希来分发密钥,而不是均匀分布的循环机制。
So, this means all events in the same partition ended up with hashes that modulo'd into that partition.因此,这意味着同一分区中的所有事件都以对那个分区取模的散列结束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.