Jerome B
02/22/2024, 4:02 PMsudo -u pulsar /opt/pulsar/apache-pulsar/bin/pulsar-admin topics stats <persistent://public/default/postprocess.request-partition-0> | grep keyHashRanges | grep -o "................$" | sort
Highest range value is 214719819 (0x7FFBA4F3)
Why it's not 2147483647 (0x7FFFFFFF) ?Jerome B
02/22/2024, 4:03 PMimport mmh3
print(mmh3.hash("D-25887".encode(), signed=False) & 0x7FFFFFFF)
Execution gives 2147395553 that's higher than the highest range associated to our consumer (ie 214719819)Jerome B
02/22/2024, 4:45 PMLari Hotari
02/22/2024, 6:56 PMHighest range value is(0x7FFBA4F3)214719819
Why it's notThe implementation explains this. https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apach[…]/broker/service/ConsistentHashingStickyKeyConsumerSelector.java Key ranges concept doesn't really map well to ConsistentHashingStickyKeyConsumerSelector. I don't think that there's a problem. In the implementation, each consumer gets mapped to the hash range 100 times. With this information it will select a consumer with this logic: https://github.com/apache/pulsar/blob/48c85ab1707004dc27022c494dbc557f7c3e888c/pul[…]/broker/service/ConsistentHashingStickyKeyConsumerSelector.java Therefore I think that the "keyHashRanges" is a misleading concept for this algorithm.(0x7FFFFFFF) ?2147483647
Lari Hotari
02/22/2024, 6:58 PMWe're thinking this is linked to an issue we've got. We noticed that the key "D-25887" was very slow to consume.It's possible that it's a coincidence that the hash of the key is close to integer maximum value. What client & version are you using ?
Lari Hotari
02/22/2024, 7:01 PMLari Hotari
02/22/2024, 7:01 PMLari Hotari
02/22/2024, 7:02 PMLari Hotari
02/22/2024, 7:08 PMLari Hotari
02/22/2024, 7:57 PMJerome B
02/22/2024, 10:27 PMselect method of ConsistentHashingStickyKeyConsumerSelector . Mainly, understand NavigateMap a Java Collection object I didn't know.
What client & version are you using ?We are using broker & client version 3.1.1