[rabbitmq-discuss] Low message publish throughput

Cameron Harris cameron at cameronharris.org
Tue Jan 25 14:42:53 GMT 2011

Hi all,

I'm having problems achieving a high publish throughput with RabbitMQ 2.2.

I am using the .NET client on two Win7/64 desktops with Core 2 duos, and the
broker is running on RHEL5.6 (OTP R14B01) on a quad core Xeon blade, and the
link between the blade and the desktops is 1Gb/s ethernet.

I created a minimal publisher and consumer in .NET and ran one on each
machine. The consumer was able to receive more than 50 000 empty messages
per second, however the publisher was only able to publish 5000 empty
messages per second before maxing out my desktop's CPU. I ported the
publisher to Java, and that went up to 10 000 per second, which is better
but still not great. The network utilization is almost insignificant and the
broker's CPU usage was around 10% on one core. The bottleneck appears to be
CPU usage inside the RabbitMQ .NET library. I achieve at least 45MB/s
throughput in a single plain TCP connection from Win7 to the blade, so the
link is definitely not the problem.

I attached a profiler to my publisher and I found that more than 90% of the
CPU time was spent calling Flush in WriteFrame (called by BasicPublish). I
created an alternate non-flushing code path in the RabbitMQ for
BasicPublish, and the publishing speed went up to between 35 000 and 45 000
messages per second, and the messages still got to the client quickly.

Am I doing something incorrect? I presume the client flushes as soon as
possible to reduce latency, but in this case, I don't mind giving up some
latency to get better throughput, such as by only explicitly flushing once
every 50ms or something along these lines. Is there a way to support my
requirements with the RabbitMQ .NET library?

Cameron Harris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110125/b709fbc3/attachment.htm>

More information about the rabbitmq-discuss mailing list