Search code examples
javamultithreadingrpcgrpc

How to configure maximum number of simultaneous connections in grpc


I am relatively new to grpc. I have followed the grpc java tutorial and have been able to generate the required classes using protocol buffer and got the client and server running, which is all good. Now I was wondering how many simultaneous client connections the server can take? Is there any way to configure it?

The reason I need to know it is that I will be deploying the server on a 32-thread machine, and each client request will be handled by a bunch of parallel worker threads. So I need some metrics as to (up to) how many threads I should spawn per request, since that should be limited by the number of simultaneous connections the server can accept.


Solution

  • There currently is no limit. There is NettyServerBuilder.maxConcurrentCallsPerConnection(), which is related but insufficient by itself. I created a issue for tracking.

    This sort of thing is definitely coming, although the exact form of it is still being designed.