[rabbitmq-discuss] Direct vs Topic exchange - Question

Konstantin Kalin konstantin.kalin at gmail.com
Wed May 2 00:48:58 BST 2012


I tried to check performance difference between Direct and Topic
exchanges with simple key (no * and #) and got unexpected results.

My test is simple: 10 publishers and 10 consumers (10 queues binded to
the exchange). Each consumer and publisher have own channel and
connection (1 to 1 relation). The routing key is pretty simple as
well: key.X where X is number of publisher/consumer. The exchanges are
declared with nowait=true. The publisher client code controls the rate
of message per second.

Test 1 - I run test for Direct exchange I get ~40k messages per second
according to RabbitMQ management plugin. CPU load is 80% on RabbitMQ
and Memory is always below the watermark. Seems to be good. RabbitMQ
management plugin shows "No flow" control on publishers connections.

Test 2 - I run same test for Topic exchange I get constantly ~4k
messages per second. CPU is around ~15% and Memory is ~200k out of
1.5Gb on RabbitMQ node. RabbitMQ management plugin shows constant
"Flow" control on publishers connections.

Could you please advise that I'm doing wrong? Why does RabbitMQ force
"Flow" control in case of Topic Exchange? I see "Flow" control on
Direct Exchange when Memory reaches high-water mark and CPU is ~90%.

I tested with RabbitMQ 2.7.0 and 2.8.2. The result is the same.  I use
Erlang client library.

Thank you,

More information about the rabbitmq-discuss mailing list