Just for the sake of correctness, the 40ms delay on Linux is not because of Nagle's Algorithm; It's the "Delayed ACK timeout" time. It's the time that a socket who just received a packet waits to send an ACK back if the process who received said packet doesn't send anything back. The wait is to minimize the number of packets in the network; if it can send some info in the same packet as the ACK, all the better. But it's not going to wait forever; it "only" waits 40 ms in Linux and 200 ms in Windows.
Nagle's algorithm waits for an ACK if the socket buffer is not full; but the 40ms wait here is not because of Nagle's algorithm directly, but because of the ACK taking 40ms to arrive. Nagle's algorithm can be disabled with TCP_NODELAY, but the "Delayed ACK timeout" in Linux cannot be disabled or changed permanently, unless you change the tcp code and recompile the kernel. Kindly David Teemu Torma wrote: > > On Monday 23 April 2007, Mittler, Nathan wrote: >> BTW, has anyone run the same test with a Java client to verify that >> it is indeed an OpenWire thing and not an activemq-cpp specific >> thing? > > I have never timed Java client, but this is general networking issue and > how TCP works. > > On linux, I see roundtrips <0.5ms if TCP_NODELAY is enabled both on > activemq-cpp and the broker, otherwise it is 80ms. For some odd > reason, I sometimes see <0.5ms and 40ms timings, but rarely. > > This is pretty similar I have seen with stomp. I have never actually > timed sending bunch of messages with openwire. Maybe stomp effectively > sends messages asynchronously and openwire waits for ack for each > message? (I have never looked what these protocols do). > > Setting TCP_NODELAY just on activemq-cpp the round-trip drops to 40ms. > The broker needs changing too to get consistent <0.5ms round-trip > latency. > > For comparison omniORB, which we also use, sets TCP_NODELAY > unconditionally for all sockets. > > Btw, the delay on Linux for Nagle's algorithm is 40ms. > > Teemu > > -- View this message in context: http://www.nabble.com/AMQCPP-Openwire-much-slower-than-Stomp--tf3599986s2354.html#a10153063 Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
