[rabbitmq-discuss] breadth vs depth for topic routing keys

Laing, Michael michael.laing at nytimes.com
Tue Aug 6 11:36:11 BST 2013

We have a routing scheme in which (initially) messages will route to 1 of
10,000 bindings in a set. There are many such sets.

The key is a pseudo-random whole number in the decimal range up to

The plan is to represent the bindings and routing keys in a way that
results in a compact and fast trie structure within rabbitmq by separating
each digit with a '.', e.g. for a typical key like '1234567' the routing
key would be '' if expressed in decimal.

But of course the key could be expressed in another base, affecting the
breadth and depth of the trie, e.g. '5.B.A.N' in base 62. A base in the
range of 10 to 62 is probably reasonable.

So for my range, base 10 has a span of 10 and a depth of 9 while base 62
has a span of 62 and a depth of 4. Any thoughts about where the optimum

Actually, after writing this I realize that I have answered my own
question: since in my case each set of bindings is a random, sparse
representation of the domain, minimizing depth will tend to form a better
trie for any one set - use base 62.

But perhaps the list will find this interesting anyway.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130806/88132f8e/attachment.htm>

More information about the rabbitmq-discuss mailing list