[rabbitmq-discuss] Publish messages only when needed ?

RomainC romain.conseil at gmail.com
Fri Oct 8 09:42:33 BST 2010


Hi and thanks for your interest !

Marek, I checked my code and I had already set the mandatory and immediate
flags to false.
Matthias, here is the description of my case :

the server (2.1.0) is started on linux after a clean.
I start 5 publishers that sends 2000 messages of 78 bytes per second on 10
exchnages. that is to say :

-10 exchanges (with x-lvc plugin that stores in mnesia database the last
value for each message)
-10000 different messages @ 1Hz (= 10000 different routeId) --> ~700Kb/s
- each exchange handles 1000 msg/s

"top" shows me a 130% CPU load with no subscriber (= no queue) for the
moment, just publishing.
Here are the control traces :

Listing exchanges ...
amq.direct	direct
amq.topic	topic
tm://SAT.DRV7	x-lvc
tm://SAT.DRV1	x-lvc
amq.rabbitmq.log	topic
tm://SAT.DRV6	x-lvc
tm://SAT.DRV2	x-lvc
tm://SAT.DRV4	x-lvc
amq.fanout	fanout
tm://SAT.DRV8	x-lvc
tm://SAT.DRV3	x-lvc
tm://SAT.DRV5	x-lvc
tm://SAT.DRV0	x-lvc
amq.headers	headers
tm://SAT.DRV9	x-lvc
	direct
amq.match	headers
...done.
Listing queues ...
...done.
Listing channels ...
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
...done.
Listing connections ...
guest	140.94.126.54	2831	running
guest	140.94.126.54	2834	running
guest	140.94.126.54	2835	running
guest	140.94.126.54	2833	running
guest	140.94.126.54	2832	running
...done.
Listing bindings ...
...done.

I made the same test with direct exchanges (without mnesia) : 
CPU load : 120%
Control traces :

Listing exchanges ...
amq.direct	direct
amq.topic	topic
tm://SAT.DRV7	direct
tm://SAT.DRV1	direct
amq.rabbitmq.log	topic
tm://SAT.DRV6	direct
tm://SAT.DRV2	direct
tm://SAT.DRV4	direct
amq.fanout	fanout
tm://SAT.DRV8	direct
tm://SAT.DRV3	direct
tm://SAT.DRV5	direct
tm://SAT.DRV0	direct
amq.headers	headers
tm://SAT.DRV9	direct
	direct
amq.match	headers
...done.
Listing queues ...
...done.
Listing channels ...
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
	guest	false	0	0
...done.
Listing connections ...
guest	140.94.126.54	2956	running
guest	140.94.126.54	2955	running
guest	140.94.126.54	2952	running
guest	140.94.126.54	2954	running
guest	140.94.126.54	2953	running
...done.
Listing bindings ...
...done.


What disturbs me is this high CPU load whereas there is no subscriber.
That's the reason why I search a way to "control the message flow sent by
publishers". for instance when listening the bindings on a subscriber.

Thanks a lot for your help.
Romain


Marek Majkowski wrote:
> 
>> I try to find some ways to enhance this. So my question : would it be
>> possible to publish essages to the exchange only if there is at least one
>> consumer that subscribed this message ? In other words, I would like to
>> implement a kind of binding listener on exchanges and a way to request
>> the
>> list of bindings (in Java).
>>
>> I searched the api and it doesn't seem to be available. I am also aware
>> that
>> this breaks the publisher/subscriber model since the publisher doesn't
>> have
>> to carry about diffusion, it just publishes.
> 
> Have you looked at the "immediate" and "mandatory" flags in basic.publish?
> 
> From http://www.rabbitmq.com/api-guide.html:
> "If a message is published with the "mandatory" or "immediate" flags
> set, but cannot be delivered, the broker will return it to the sending
> client (via a AMQP.Basic.Return command)."
> 
> 
> Cheers,
>   Marek
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> 

-- 
View this message in context: http://old.nabble.com/Publish-messages-only-when-needed---tp29904396p29913525.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101008/91e43974/attachment-0001.htm>


More information about the rabbitmq-discuss mailing list