Thrift
  1. Thrift
  2. THRIFT-1915 Multiplexing Services
  3. THRIFT-66

Java: Allow multiplexing multiple services over a single TCP connection

    Details

    • Patch Info:
      Patch Available

      Description

      The current TServer implementations expose a single service on a port. If an application has many services many ports have to be opened. This is cumbersome because:

      • you have to document which service is available on which port, and remembering the port numbers is difficult
      • to prevent the overhead of connection setup on each call, a client has to maintain to many connections: at least one to each port
      • it requires opening many ports on a firewall if one is between the client and the server.

      By multiplexing multiple services on a single port the problems above are resolved:

      • instead of a port number a symbolic name can be assigned to a service
      • a client can maintain a small pool of connections to a single port
      • only one port has to be opened on the firewall

      The attached Java implementation simply wraps a normal CALL message with a (new) SERVICE_SELECTION message. It is not necessary to modify or wrap the response. No changes are needed to the generated classes. Only a new type of server is introduced, and an invocation handler for a dynamic proxy around the Client classes of services is provided for the client side. The implementation does not handle communication errors (invalid data, timeouts, etc.) yet.

      1. CalculatorImpl.java
        2 kB
        Johan Stuyts
      2. MultiplexTestClientMain.java
        3 kB
        Johan Stuyts
      3. MultiplexTestServerMain.java
        1 kB
        Johan Stuyts
      4. ReleaseWaitingReplyThreadsOnDisconnect.patch
        2 kB
        James E. King, III
      5. SharedImpl.java
        0.5 kB
        Johan Stuyts
      6. ThriftCSharpEndpointsChannels.zip
        264 kB
        James E. King, III
      7. Thrift Endpoints and Channels.vsd
        141 kB
        James E. King, III
      8. ThriftMultiplexInvocationHandler.java
        2 kB
        Johan Stuyts
      9. TMultiplexServer.java
        3 kB
        Johan Stuyts
      10. TMultiplexServer.py
        14 kB
        ruslan.usifov
      11. TSimpleMultiplexServer.java
        5 kB
        Johan Stuyts

        Issue Links

          Activity

          Jake Farrell made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Jake Farrell made changes -
          Fix Version/s 0.9.2 [ 12324954 ]
          Roger Meier made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Roger Meier [ roger.meier ]
          Resolution Unresolved [ 9 ]
          Jens Geyer made changes -
          Link This issue is related to THRIFT-251 [ THRIFT-251 ]
          Jens Geyer made changes -
          Link This issue is duplicated by THRIFT-251 [ THRIFT-251 ]
          Jens Geyer made changes -
          Link This issue is duplicated by THRIFT-251 [ THRIFT-251 ]
          Roger Meier made changes -
          Summary Allow multiplexing multiple services over a single TCP connection Java: Allow multiplexing multiple services over a single TCP connection
          Roger Meier made changes -
          Parent THRIFT-1915 [ 12640568 ]
          Issue Type New Feature [ 2 ] Sub-task [ 7 ]
          James E. King, III made changes -
          James E. King, III made changes -
          Attachment ThriftCSharpEndpointsChannels.zip [ 12451684 ]
          James E. King, III made changes -
          Attachment Thrift Endpoints and Channels.vsd [ 12447999 ]
          ruslan.usifov made changes -
          Attachment TMultiplexServer.py [ 12436303 ]
          Bryan Duxbury made changes -
          Priority Major [ 3 ] Trivial [ 5 ]
          Johan Stuyts made changes -
          Attachment TSimpleMultiplexServer.java [ 12385016 ]
          Johan Stuyts made changes -
          Attachment ThriftMultiplexInvocationHandler.java [ 12385014 ]
          Attachment TMultiplexServer.java [ 12385015 ]
          Attachment SharedImpl.java [ 12385013 ]
          Johan Stuyts made changes -
          Field Original Value New Value
          Attachment CalculatorImpl.java [ 12385010 ]
          Attachment MultiplexTestServerMain.java [ 12385012 ]
          Attachment MultiplexTestClientMain.java [ 12385011 ]
          Johan Stuyts created issue -

            People

            • Assignee:
              Roger Meier
              Reporter:
              Johan Stuyts
            • Votes:
              13 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development