[rabbitmq-discuss] Huge latency in Linux, compared with Leopard

Matthias Radestock matthias at lshift.net
Sat Sep 27 20:26:29 BST 2008


Holger,

Holger Hoffstätte wrote:

> - the fixed penalty for small packets reminded me of good old Mr. Nagle
> who is not your friend when it comes to latency..and behold! Setting
> TCP_NODELAY in both the Java client's SocketFrameHandler and the Rabbit
> startup script (as documented in inet: {nodelay, Boolean}) did the trick,
> even *with* auto-ack!

Adding the line

     -kernel inet_default_listen_options '[{nodelay, true}]' \

to the options in the rabbitmq-server script does improve the results 
significantly.

When running the tests

   sh runjava.sh com.rabbitmq.examples.MulticastMain -r 100 -s 1024 -a

rather than getting min/avg/max latencies of 1500/25000/45000 
microseconds I now get 750/1000/1200 for 2 out of 3 results, though the 
third result is still off the scale.

Turning to the Java client and adding the line

           _socket.setTcpNoDelay(true);

to the SocketFrameHandler constructor reduced the figures to 450/500/750 
!! There's the occasional 1200 microsecond max, but that's nothing like 
the variation we saw before and is perfectly acceptable.

Thanks Holger for this excellent piece of investigative work.

So should we make TCP_NODELAY the default?


Matthias.




More information about the rabbitmq-discuss mailing list