[rabbitmq-discuss] Direct vs Topic exchange - Question

Konstantin Kalin konstantin.kalin at gmail.com
Wed May 2 17:09:14 BST 2012


Hello, Simon.

Thank you for looking at this. Please see inline. 

On May 2, 2012, at 6:34 AM, Simon MacMullen wrote:

> On 02/05/12 00:48, Konstantin Kalin wrote:
>> 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.
> 
> This is very odd, and not what I would expect at all.
> 
> Topic exchanges are slower than direct exchanges - the routing logic is after all more complicated - but it certainly shouldn't be a factor of 10.
> 
> Also, if you are pushing messages as fast as you can at Rabbit 2.8.0+, it should go into flow control regardless of where the actual bottleneck is.
> 
> Can you post the code you were running?
> 

Sure. Please look at attached file. It contains the source code that I runs. It can be compiled using rebar.
Here is short explanation for the code:
apps ->
	common - library module. It contains connection pool, publisher and consumer worker modules. I use connection pool since I also do testing for RabbitMQ cluster.
	consumer - Consumer app. It's kinda stupid app with one supervisor to start consumer workers and API helpers functions. See consumer.erl
	publisher - Publisher app. It's same as the consumer app. There is API module as well (publisher.erl)
lib ->
	rabbit_common
	amqp_client 

All code is pretty straight forward. Connection pool accepts URLs and amount of connections per URL. It works in Round-Robin mode. Publisher does "basic.publish" and Consumer uses subscription. 

I will continue digging it. What's odd for me RabbitMQ does "Flow control" when it seems to be fine: Memory and CPU are low on RabbitMQ node. It looks like there is no reason to do "flow control". 

P.S. RabbitMQ node is VM with 8 CPUs and 4Gb memory. 


> Cheers, Simon
> 
> -- 
> Simon MacMullen
> RabbitMQ, VMware

Thank you,
Kostya.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rabbitMQ.tar.gz
Type: application/x-gzip
Size: 481510 bytes
Desc: not available
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120502/ba8f7e71/attachment.bin>


More information about the rabbitmq-discuss mailing list