[rabbitmq-discuss] Possibly latency issues

Simon MacMullen simon at rabbitmq.com
Tue Feb 14 13:24:10 GMT 2012

On 14/02/12 02:47, Sam Crawley wrote:
> Running this, I always get an average time (and I'm obviously only
> timing the reading of messages) of 0.04s. (FWIW, I get the same with our
> home grown client).
> Does it seem like there's something wrong here?

Yes. Very much so. I replicated your problem.

The problem is that the old version of librabbitmq that is embedded in 
Net::RabbitMQ does not disable Nagle's algorithm. (I assume your 
homebrew client also does not.)

Looking in wireshark we see that almost all of the delay happens after 
the basic.publish, when the TCP stack waits 0.04s (on my machine) for 
more data before *actually* sending the publish. Everything else is very 
fast in comparison, giving an almost perfect 25 msg/s for me.

I hacked in a call to setsockopt() to set TCP_NODELAY in amqp_socket.c, 
and now I get:

Longest request: 0.000537, Shortest Request: 0.000146
Mean Req time: 0

Which I think is more the performance you might be looking for. 
(Presumably the "mean req time" suffered underflow.)

The current version of librabbitmq sets TCP_NODELAY, so maybe 
Net::RabbitMQ should be updated? (CCing maintainer...)

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list