Erlang Mailing Lists

Author Message

<  RabbitMQ mailing list  ~  [Q] fanout exchange same as direct with blank routing key?

Guest
Posted: Wed Dec 09, 2009 12:14 pm Reply with quote
Guest
On Thu, Dec 03, 2009 at 01:01:50PM -0600, Chuck Remes wrote:
> My question is in the subject.

The answer is no. Wink

They are the same only if every binding to the direct exchange uses an
empty binding key, and, as you say, all the publishes are with a
blank routing key.

In many ways, you can think of a direct exchange as a cluster of fanout
exchanges where there is implicitly a fanout for every routing key and
binding key.

> The only difference I can
> think of would be that there might be some matching done against the
> empty string routing key for delivery through the direct exchange that
> is skipped for the fanout exchange. Therefore, a fanout exchange would
> have *slightly* better performance versus a direct exchange with an
> empty routing key.

Correct, and the greater the number of different binding keys the direct
exchange has, the slower it will be. So if performance is important to
you, and you can get away with using a fanout, do so.

Matthew

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
tonyg
Posted: Fri Dec 18, 2009 12:07 pm Reply with quote
User Joined: 07 Nov 2006 Posts: 199
Matthew Sackman wrote:
> Correct, and the greater the number of different binding keys the direct
> exchange has, the slower it will be. So if performance is important to
> you, and you can get away with using a fanout, do so.

Hmm, this shouldn't be the case; fanout exchanges query the binding
table with a pattern of (name=ExchangeName, key=_), whereas direct
exchanges query it with (name=ExchangeName, key=RoutingKey). The
internal mnesia logic and indexing should be almost identical, as should
the performance; hmm, I'll see if I can measure it this afternoon.

Tony

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
View user's profile Send private message MSN Messenger

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum