You can put a TCP proxy like HAproxy in front of your gRPC server and limit the number of clients to whatever number you want.
HTH On Thursday, August 4, 2016 at 12:21:19 AM UTC-7, Chaitanya Gangwar wrote: > > Hi David, > > I want something similar to backlog argument in grpc server api. This is > exactly what my requirement is. I am sorry if my previous message created > some confusion. > What i want is, if there are already 8 accpeted client connections, after > that no new client should connect, once one of connected client goes off, > thn new client can connect to server. Its like, at a time, server should > serve max of 8 clients. > > Thanks > Chaitanya > > On Thursday, 4 August 2016 12:42:35 UTC+5:30, David Klempner wrote: >> >> The backlog argument only affects connections that haven't been accepted >> yet. It does nothing to connections that have already been accepted. >> >> What is it that you're trying to accomplish by limiting the number of >> connections to 8? >> <http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem> That >> is a remarkably odd and specific requirement. >> >> On Wed, Aug 3, 2016 at 11:58 PM, Chaitanya Gangwar <[email protected] >> > wrote: >> >>> Hi Vijay, >>> >>> In normal tcp connection, listen api, takes backlog as argument which >>> can be used to limit the max number of connections. I am looking something >>> similar in grpc server api as well. i thought the grpc also internally >>> make same calls so there should be a way to restrict maximum connections. >>> Please correct me if i am wrong. >>> >>> *listen(int **sockfd**, int **backlog* >>> *);*The *backlog* argument defines the maximum length to which the queue of >>> pending connections for *sockfd* may grow. If a connection request >>> arrives when the queue is full, the client may receive an error with >>> an indication of *ECONNREFUSED *or, if the underlying protocol >>> supports >>> retransmission, the request may be ignored so that a later reattempt >>> at connection succeeds >>> >>> Thanks >>> Chaitanya >>> >>> >>> >>> On Wednesday, 3 August 2016 20:03:29 UTC+5:30, Vijay Pai wrote: >>>> >>>> There currently isn't such an API from either core or C++ to do so. >>>> Depending on the platform, I presume that one could use a process-wide FD >>>> limit to limit the number of open connections before starting the server, >>>> but that would be outside the current scope of gRPC. >>>> Regards, >>>> Vijay >>>> >>>> On Tuesday, August 2, 2016 at 10:30:18 PM UTC-7, Chaitanya Gangwar >>>> wrote: >>>>> >>>>> I am using C++ grpc library. >>>>> >>>>> -Chaitanya >>>>> >>>>> On Tuesday, 2 August 2016 10:11:13 UTC+5:30, Chaitanya Gangwar wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> Is there any way to limit maximum number of connections in grpc >>>>>> server ? I want to limit number of connections till 8 and after that >>>>>> server >>>>>> should reject any more new client connections. >>>>>> >>>>>> Thanks >>>>>> Chaitanya >>>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "grpc.io" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/grpc-io/a704aa13-f55b-44c7-9a99-229cc66ec2b0%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/grpc-io/a704aa13-f55b-44c7-9a99-229cc66ec2b0%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/6cb18f08-1868-4efd-9773-2545e730a0fd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
