[ 
https://issues.apache.org/jira/browse/THRIFT-3084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521335#comment-14521335
 ] 

ASF GitHub Bot commented on THRIFT-3084:
----------------------------------------

GitHub user jeking3 opened a pull request:

    https://github.com/apache/thrift/pull/473

    THRIFT-3084 add optional concurrent client limit enforcement to lib/cpp

    This allows users of TThreadedServer and TThreadPoolServer to declare the 
maximum number of concurrent clients allowed in at any given time.  When the 
limit is reached, the serve() thread is blocked from accept()ing another 
connection until one of the other connections closes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jeking3/thrift 
feature/THRIFT-3084-after-THRIFT-3083-merge-to-master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/473.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #473
    
----
commit 8ab5ec65835b182f5e726145536c03454cda37f6
Author: Jim King <jim.k...@simplivity.com>
Date:   2015-04-30T11:10:08Z

    THRIFT-3084 add optional concurrent client limit enforcement to lib/cpp 
threaded servers

----


> C++ add concurrent client limit to threaded servers
> ---------------------------------------------------
>
>                 Key: THRIFT-3084
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3084
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>    Affects Versions: 0.8, 0.9, 0.9.1, 0.9.2
>            Reporter: James E. King, III
>         Attachments: THRIFT-3084-on-3083.v2.patch
>
>
> 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).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to