[zeromq-dev] discussion on routing algorithms

Martin Sustrik sustrik at fastmq.com
Fri Jan 23 23:18:06 CET 2009

> What I see as particularly interesting is the case where's the set of 
> topics is fixed tree-like hierarchy and the subscriptions have to have 
> wildcard on the end only (e.g. "ibm.stocks.*"). In this case we can get 
> routing overhead as low as 2 machine instructions as you've suggested 
> above. This would mean just couple of CPU ticks = several nanoseconds 
> per match.

I'm attaching a diagram showing how such matching can be done. It's 
pretty simple, but it works only if 1.) topics form a hierarchy that is 
immutable and know in advance 2.) the wildcard (*) can be only at the 
end of the subscription request (e.g. animals.* but not *.vertebrates) 
Luckily both requirements are often met in real-life scenarios.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: topics.png
Type: image/png
Size: 20954 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090123/982c8f64/attachment.png>

More information about the zeromq-dev mailing list