[rabbitmq-discuss] Unexpected Behavior When Using the "X-Consistent-Hash" Exchange Type

Richard Raseley richard at raseley.com
Mon Oct 21 17:48:54 BST 2013


Simon,

Thanks for your reply - it was very helpful.

Regards,

Richard


On Mon, Oct 21, 2013 at 8:30 AM, Simon MacMullen <simon at rabbitmq.com> wrote:

> On 17/10/2013 12:13AM, Richard Raseley wrote:
>
>> This leaves me with the following questions:
>>
>> 1) Is it true to say that it is now just a matter of choosing what
>> tradeoff we want to make in terms of performance vs. uniformity of
>> distribution?
>>
>
> Yes.
>
>
>  2) Can anyone comment on Michael's previous comment on how using a
>> UUID would be handled as the value in the hashed header? The numbers
>> above don't seem to show a large difference between using a random
>> integer and a UUID.
>>
>
> No, they don't. The actual hashing is done by the Erlang function phash2,
> which will hash a UUID or an integer or any Erlang term.
>
>
>  As a final question, can anyone on the engineering team provide a
>> recommendation as to the best way to generate a header value for
>> hashing use in terms of what will implicitly provide the most even
>> distribution?
>>
>
> It doesn't matter.
>
> Yeah, this confused me too when I first started looking at the hashing
> exchange. As long as you use something that tends towards unique-ish values
> then any unevenness in the routing displayed by the CHX is caused by the
> distribution of the buckets in its routing table - this is influenced by
> the number of points each binding has (as you have already noted) *and
> nothing else*.
>
> You can observe this easily - create some queues and bindings with 1 point
> each. Then publish some messages with random integers as the routing keys.
> Observe the uneven distribution. Then purge all the queues (but don't
> delete and start again) and re-run the test with UUIDs or message sequence
> IDs or whatever. Not only will the distribution still be uneven, but it
> will be uneven in exactly the same way.
>
> Cheers, Simon
>
> --
> Simon MacMullen
> RabbitMQ, Pivotal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131021/98c55096/attachment.htm>


More information about the rabbitmq-discuss mailing list