XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0, 4.1.0, 5.0.0
    • 5.0.0
    • None
    • Any.

    Description

      A. Description
      Setting the wireFormat.tcpNoDelayEnabled flag to true in connection uri's (for example "tcp://localhost:61616?wireFormat.tcpNoDelayEnabled") has no effect:
      The sockets created in ActiveMQ do not have the TcpNoDelay flag set to true.
      You can verify this for example in the following way: insert the line System.err.println(sock.getTcpNoDelay()); at the end of the method
      org.apache.activemq.transport.tcp.TcpTransport.initialiseSocket.
      Also you can try my test at http://www.nabble.com/High-latency-for-small-messages-problem-t3159901.html which makes latency appear if Nagle's algorithm is not disabled.
      This affects versions 4.0, 4.1.0, and 4.2.0 latest snapshot. I guess 4.0.2 is affected too.

      B. Reason
      After looking at the source code to understand how the options are set, i saw that in the method org.apache.activemq.transport.tcp.TcpTransportFactory.compositeConfigure the following line appears:
      Map socketOptions = IntrospectionSupport.extractProperties(options, "socket.");

      and also that the method to set the TcpNoDelay option in class org.apache.activemq.transport.tcp.TcpTransport is called setTcpNoDelay and not setTcpNoDelayEnabled

      Therefore, I tried to write "socket.tcpNoDelay=true" instead of "wireFormat.tcpNoDelayEnabled=true" and it worked! This is a workaround.

      But, "wireFormat.tcpNoDelayEnabled" option is not refused (as "wireFormat.tcpNoDelayTypoEnabled" would be). The option "tcpNoDelay=true" is not refused either, but DOES NOT work either.

      C. Fix
      So, please, for the sake of the poor soul who's next going to try to disable Nagle's algorithm without noticing any effect, and will start looking for the problem elsewhere (and for the sake of consistency also):
      -Either change the documentation (http://www.activemq.org/site/tcp-transport-reference.html and http://www.activemq.org/site/configuring-wire-formats.html) to say that one should use the socket.tcpNoDelay option, or
      -Change the code to obey the documentation (and make it refuse old options like just "tcpNoDelay" who have no effect).

      Personally I would change the documentation ASAP so that people know about the "socket.tcpNoDelay=true" workaround until next version, and then change the code to recognize the "wireFormat.tcpNoDelayTypoEnabled" option. I'd like to point out that the own ActiveMQ test cases use "wireFormat.tcpNoDelayTypoEnabled" .

      D. Related issues
      This is related to a previous post of mine: http://www.nabble.com/High-latency-for-small-messages-problem-t3159901.html
      Doing quick synchronized sends showed a 39ms latency if the broker is running in Linux, and a 200ms latency if the broker is in Windows (by the way, if someone knows the bottom reason for this exact latency times, please tell me). Putting the "wireFormat.tcpNoDelayTypoEnabled" to true in order to disable Nagle's algorithm had no effect (because ActiveMQ does not recognize it).

      Very probably this is also related to issues https://issues.apache.org/activemq/browse/AMQ-1143 and https://issues.apache.org/activemq/browse/AMQ-1137 (in this one probably Helmutt tried to set the wireFormat.tcpNoDelayTypoEnabled without success because of this).

      Attachments

        Issue Links

          Activity

            People

              chirino Hiram R. Chirino
              davidmc David Martín Clavo
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: