merlimat commented on issue #6647: URL: https://github.com/apache/pulsar/pull/6647#issuecomment-617884885
> The difference is I hashed the key twice before, this change is reduced one hash calculation in the selector. I think it's actually the reverse, the % operation is done for each message instead of for each "key" > Another difference is, I group the messages by the message key, but when users use random keys, the dispatcher can get benefit from the group operation. So the new way is grouped by hash(key) % ranges, so that we can also get group benefit for random keys. The benefit is we can reduce operates of the LinkedHashMap. I think this only matters if `rangeSize` is small. With rangeSize = 65K or bigger there's no practical grouping benefit. If rangeSize=4, of course, this approach would be more efficient. I believe a better approach here, instead of exposing the index internals, would be to just group by consumers instead of key or index. Basically, construct `Map<Consumer, List<Entry>>` and then dispatch. This would work for any `rangeSize`. I'll make this change after #6791. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
