ActiveMQ
  1. ActiveMQ
  2. AMQ-2636

Add support for setting the Differentiated Services or Type Of Service on outgoing TCP/IP packets to support Quality Of Service

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.0
    • Fix Version/s: 5.4.0
    • Component/s: Transport
    • Labels:
      None
    • Environment:

      Affects all OSes, proposed fix has only been tested on Ubuntu 9.10

    • Patch Info:
      Patch Available

      Description

      It should be possible to specify the desired Differentiated Services class, as outlined in RFC 2475 (http://tools.ietf.org/html/rfc2475), or Type of Service value, on outgoing TCP/IP packets by specifying a diffServ or typeOfService Tcp Transport Option (http://activemq.apache.org/tcp-transport-reference.html).

      e.g. tcp://somehost:61616?trace=false&soTimeout=60000&diffServ=AF21
      e.g. tcp://somehost:61616?trace=false&soTimeout=60000&typeOfService=3

      I am part of a student group (http://maljub01.svnrepository.com/comp190/trac.cgi/wiki) at Tufts University that is implementing this functionality in ActiveMQ for potential use by MIT Lincoln Labs as part of the NextGen Network Enabled Weather Program (https://wiki.ucar.edu/display/NNEWD/The+NNEW+Wiki)..

      We would like to contribute our changes back to the ActiveMQ trunk, if possible. Attached is a initial patch against the 5.3.0 release version, which implements setting the Differentiated Services class via a Tcp Transport Option on the connection URI.

      Some notes about this approach:

      The basic underlying mechanism for actually setting the bits in the packet headers is the java.net.Socket.setTrafficClass method. This was
      the most elegant implementation out of all the possible implementations that we came up with.

      In order for setTrafficClass to work in JDK 6, it is necessary to set the System property java.net.preferIPv4Stack to be true. We found that this has precedent in ActiveMQ (http://activemq.apache.org/multicast-watch-out-for-ipv6-vs-ipv4-support-on-your-operating-system-or-distribution-or-network.html), but we are hoping that this issue will be resolved in JDK 7, so that we can use the IPv6 stack when possible.

      In addition, the current implementation only sets the specified Differentiated Services bits on the outgoing packets, and has no control over the Acknowledgments sent back for those packets. We have yet to find an elegant and cross-platform way to have the ActiveMQ Broker find out what the Differentiated Services bits on the incoming packets are directly in Java, although we are considering approaches that would involve calling a shell script from TcpTransportServer that would utilize IPtables.

      We would like to know if might be interested in accepting this work into the ActiveMQ trunk. The sooner you let us know one way or another, the better, as this is a single-semester project.

      1. addDiffServToTcpTransport.patch
        16 kB
        Jessie Berlin
      2. addToSSupportAndRefactoring.patch
        28 kB
        Jessie Berlin
      3. fixECNBits.patch
        5 kB
        Jessie Berlin
      4. ASF.LICENSE.NOT.GRANTED--fixECNBitsAndAddCSDiffServNames.patch
        7 kB
        Jessie Berlin
      5. brokerConfig.tar.gz
        4 kB
        Jessie Berlin

        Activity

        Hide
        Rob Davies added a comment -
        Show
        Rob Davies added a comment - IP Tables scripts referenced from here: https://cwiki.apache.org/confluence/display/ACTIVEMQ/TCP+Transport+Reference
        Hide
        Jessie Berlin added a comment -

        This tar.gz file contains the IPTables scripts which can be used to configure that broker so that all outgoing packets from the broker match the DSCP value set on the incoming packets on that connection.

        Show
        Jessie Berlin added a comment - This tar.gz file contains the IPTables scripts which can be used to configure that broker so that all outgoing packets from the broker match the DSCP value set on the incoming packets on that connection.
        Hide
        Dejan Bosanac added a comment -

        added missing diff serv names with svn revision 938461

        Show
        Dejan Bosanac added a comment - added missing diff serv names with svn revision 938461
        Hide
        Rob Davies added a comment -

        Added latest patch in SVN revision 937272

        Show
        Rob Davies added a comment - Added latest patch in SVN revision 937272
        Hide
        Rob Davies added a comment -

        Applied ECNBits patch in SVN revision 937265

        Show
        Rob Davies added a comment - Applied ECNBits patch in SVN revision 937265
        Hide
        Jessie Berlin added a comment -

        This patch fixes the issue with the ECN bits as described above, and also adds 8 more Differentiated Services Code Point names, CS0 through CS7. If this patch is committed, the documentation found on http://activemq.apache.org/tcp-transport-reference.html needs to be updated for the diffServ option to add those new names.

        This patch is against r932870 and obsoletes the fixECNBits patch.

        Show
        Jessie Berlin added a comment - This patch fixes the issue with the ECN bits as described above, and also adds 8 more Differentiated Services Code Point names, CS0 through CS7. If this patch is committed, the documentation found on http://activemq.apache.org/tcp-transport-reference.html needs to be updated for the diffServ option to add those new names. This patch is against r932870 and obsoletes the fixECNBits patch.
        Hide
        Jessie Berlin added a comment -

        See above comments.

        Show
        Jessie Berlin added a comment - See above comments.
        Hide
        Jessie Berlin added a comment -

        This patch fixes an issue that was discovered by running our automated wireshark test scripts where I was assuming the wrong two bits for the ECN bits, and so only multiples of 4 were working on machines which use 0 for the default ECN.

        (tested against trunk)

        The code for the automated wireshark test scripts can currently be found here: http://maljub01.svnrepository.com/comp190/trac.cgi/browser/scripts/dscp_test

        Is there some way we can either include the automated wireshark test scripts somewhere in the ActiveMQ trunk (maybe as an example, since it involves a Producer that communicates with the ActiveMQ broker) or put it somewhere on the ActiveMQ website so that future uses can benefit from it?

        Show
        Jessie Berlin added a comment - This patch fixes an issue that was discovered by running our automated wireshark test scripts where I was assuming the wrong two bits for the ECN bits, and so only multiples of 4 were working on machines which use 0 for the default ECN. (tested against trunk) The code for the automated wireshark test scripts can currently be found here: http://maljub01.svnrepository.com/comp190/trac.cgi/browser/scripts/dscp_test Is there some way we can either include the automated wireshark test scripts somewhere in the ActiveMQ trunk (maybe as an example, since it involves a Producer that communicates with the ActiveMQ broker) or put it somewhere on the ActiveMQ website so that future uses can benefit from it?
        Hide
        Jessie Berlin added a comment -

        I created an account on the confluence site (jessieberlin), but it still says that I am "Not Permitted" edit the TCP Transport Reference Page (http://activemq.apache.org/tcp-transport-reference.html).

        The changes that I want to make are as follows (adding on these rows to the main table):

        Option Name Default Value Description
        diffServ 0 (client only) The preferred Differentiated Services traffic class to be set on outgoing packets, as described in RFC 2475. Valid integer values: [0,64). Valid string values: EF or AF[1-4][1-3]. With JDK 6, only works when the Java Runtime uses the IPv4 stack, which can be done by setting the java.net.preferIPv4Stack system property to be true. Cannot be used at the same time as the typeOfService option.
        typeOfService 0 (client only) The preferred Type of Service value to be set on outgoing packets. Valid integer values: [0,256). With JDK 6, only works when the Java Runtime uses the IPv4 stack, which can be done by setting the java.net.preferIPv4Stack system property to be true. Cannot be used at the same time as the diffServ option
        Show
        Jessie Berlin added a comment - I created an account on the confluence site (jessieberlin), but it still says that I am "Not Permitted" edit the TCP Transport Reference Page ( http://activemq.apache.org/tcp-transport-reference.html ). The changes that I want to make are as follows (adding on these rows to the main table): Option Name Default Value Description diffServ 0 (client only) The preferred Differentiated Services traffic class to be set on outgoing packets, as described in RFC 2475 . Valid integer values: [0,64). Valid string values: EF or AF [1-4] [1-3] . With JDK 6, only works when the Java Runtime uses the IPv4 stack, which can be done by setting the java.net.preferIPv4Stack system property to be true. Cannot be used at the same time as the typeOfService option. typeOfService 0 (client only) The preferred Type of Service value to be set on outgoing packets. Valid integer values: [0,256). With JDK 6, only works when the Java Runtime uses the IPv4 stack, which can be done by setting the java.net.preferIPv4Stack system property to be true. Cannot be used at the same time as the diffServ option
        Hide
        Rob Davies added a comment -

        Updated patch applied by SVN revision 926152.
        Please update the documentation!

        Show
        Rob Davies added a comment - Updated patch applied by SVN revision 926152. Please update the documentation!
        Hide
        Jessie Berlin added a comment -

        Thanks for committing our initial patch!

        I will shortly be attaching a second patch (against svn revision 921822 of the ActiveMQ trunk) that adds in support for setting the Type Of Service bits as well as the Differentiated Services bits. The patch will also cleans up some tabs and incorrect spacing that I mistakenly let slip into the previous patch as well as does some refactoring on the TransportUriTests.

        When would it be appropriate for me to add new information about this new Transport option to the existing documentation (http://activemq.apache.org/tcp-transport-reference.html)?

        Show
        Jessie Berlin added a comment - Thanks for committing our initial patch! I will shortly be attaching a second patch (against svn revision 921822 of the ActiveMQ trunk) that adds in support for setting the Type Of Service bits as well as the Differentiated Services bits. The patch will also cleans up some tabs and incorrect spacing that I mistakenly let slip into the previous patch as well as does some refactoring on the TransportUriTests. When would it be appropriate for me to add new information about this new Transport option to the existing documentation ( http://activemq.apache.org/tcp-transport-reference.html)?
        Hide
        Rob Davies added a comment -

        Fixed by svn revision 920395

        Show
        Rob Davies added a comment - Fixed by svn revision 920395
        Hide
        Jessie Berlin added a comment -

        Patch referred to in previous description.

        Show
        Jessie Berlin added a comment - Patch referred to in previous description.

          People

          • Assignee:
            Rob Davies
            Reporter:
            Jessie Berlin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development