<div dir="ltr"><div>We have encountered some unexpected behavior when using the &quot;x-consistent-hash&quot; exchange type that I am hoping someone on the list can help us understand.�</div><div><br></div><div>At a high level, the issue we&#39;re experiencing is that in our testing of the &quot;x-consistent-hash&quot; exchange we aren&#39;t able to get even (or roughly even) distribution of messages between the queues bound to the exchange.</div>
<div><br></div><div>Here is a link to the full broker configuration export ( <a href="http://pastebin.com/nkcXskpY">http://pastebin.com/nkcXskpY</a> ) but at a high level we are doing the following:<br><br>1) Topic exchange named &quot;logging.topic&quot; is bound to hash exchange &quot;error.hash&quot; with routing key &quot;error.#&quot; (our eventual goal is to have several of these).</div>
<div>2) Hash exchange &quot;error.hash&quot; is configured with parameters &quot;hash-header: message-distribution-hash&quot;.</div><div>3) Queues named &quot;error01&quot; through &quot;error16&quot; are bound to the &quot;error.hash&quot; exchange each with routing key of &quot;1&quot; (to ensure they each get an equal slice of the hash range).<br>
</div><div><br></div><div>When executing a simple test script ( <a href="http://pastebin.com/e7EjZ1TD">http://pastebin.com/e7EjZ1TD</a> ), which sends 500K messages to the &quot;logging.topic&quot; with a &quot;message-distribution-hash&quot; header that a value that is a UUID converted to a string, I see quite unequal distribution of the messages across the queues. I ran three tests of 500K messages (resetting and reloading the broker configuration between each test) and I get the following results:<br>
<br><div>**FIRST TEST**</div><div>�</div><div>Queue Name,Message Count</div><div>error01,73616</div><div>error02,65789</div><div>error03,12986</div><div>error04,15029</div><div>error05,12026</div><div>error06,51006</div><div>
error07,465</div><div>error08,95926</div><div>error09,34857</div><div>error10,16858</div><div>error11,19075</div><div>error12,25155</div><div>error13,25002</div><div>error14,14994</div><div>error15,8878</div><div>error16,28338</div>
<div>TOTAL,500000</div><div>�</div><div>**SECOND TEST**</div><div>�</div><div>Queue Name,Message Count</div><div>error01,23124</div><div>error02,5122</div><div>error03,29047</div><div>error04,24405</div><div>error05,1467</div>
<div>error06,1312</div><div>error07,28045</div><div>error08,35258</div><div>error09,164437</div><div>error10,25851</div><div>error11,40669</div><div>error12,24821</div><div>error13,17316</div><div>error14,18611</div><div>
error15,41183</div><div>error16,19332</div><div>TOTAL,500000</div><div>�</div><div>**THIRD TEST**</div><div>�</div><div>Queue Name,Message Count</div><div>error01,26655</div><div>error02,77116</div><div>error03,405</div><div>
error04,24106</div><div>error05,10543</div><div>error06,7734</div><div>error07,37476</div><div>error08,25048</div><div>error09,32156</div><div>error10,43750</div><div>error11,92675</div><div>error12,14325</div><div>error13,50265</div>
<div>error14,18449</div><div>error15,2665</div><div>error16,36632</div><div>TOTAL,500000</div></div><div><br></div><div>As you can see, some queues get *many* more messages than other queues for example in the third test we see that one queue (error03) received only 405 messages (0.081% of the total) while another (error11) received 92675 (18.53% of the total). With all this in mind, my questions are as follows:</div>
<div><br></div><div>1) Why am I seeing such uneven distribution of messages between the queues bound to the x-consistent-hash exchange?</div><div><br></div><div>2) What can I do to ensure the most even distribution of messages as possible across the queues bound to the x-consistent-has exchange?</div>
<div><br></div><div>Regards,</div><div><br></div><div>Richard Raseley</div></div>