Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3084

C++ add concurrent client limit to threaded servers

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8, 0.9, 0.9.1, 0.9.2
    • Fix Version/s: 0.9.3
    • Component/s: C++ - Library
    • Labels:
      None

      Description

      The TThreadedServer and TThreadPoolServer do not impose limits on the number of simultaneous connections, which is not useful in production as bad clients can drive a server to consume too many file descriptors or have too many threads.

      With TThreadPoolServer one can set the limit on the number of threads, however the server will use one additional file descriptor because the serve() routine does not block until after accepting the threadManager size + 1 sockets.

      With TThreadedServer there was no built-in way to throttle.

      Give the serve() loop is the only code capable of adding a client, the solution is to add a Monitor to the TServerFramework and check the number of concurrent clients immediately before calling TServerTransport::accept() to get another client, and to track the number of clients that are still alive (their smart pointer hasn't been destroyed).

        Attachments

        1. THRIFT-3084-on-3083.v2.patch
          32 kB
          James E. King III

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                jking3 James E. King III
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: