Thx for the explanation. But wWhat about having 1000 or 10000 
bi-directional client streams on the server which may have long waiting 
async calls to the backend. Is there a need to customize the thread size?

Am Mittwoch, 11. März 2020 22:29:31 UTC+1 schrieb Christopher Warrington - 
MSFT:
>
> On Wednesday, March 11, 2020 at 1:30:57 PM UTC-7, Martin Scholz wrote:
>  
> > Is there any documentation how gRPC on server side with .NET or C# is
> > handling multiple request under the hood.
>
> The closest that I know of is the GrpcEnvironment API documentation [1].
>
> > Does every request consume a thread until it's finished. Or can another
> > request use the this thread when it is asnyc?
>
> gRPC C# uses its own thread-pool [2] to handle gRPC operations like reading
> from and writing to the network, monitoring for timeouts, and cancelling
> requests. After it has figured out which user code to invoke, by default, 
> it
> uses the .NET thread pool to run that code. The guards against buggy/slow
> user code blocking gRPC from making forward progress.
>
> > And what it is the number of concurrent requests/threads.
>
> Unless customized by calling one of the methods on GrpcEnvironment [3], the
> larger of 4 and Environment.ProcessorCount / 2 threads are used to poll 4
> completion queues. (A completion queue is the underlying data structure 
> that
> gRPC uses to manage its operations.)
>
> [1]: https://grpc.github.io/grpc/csharp/api/Grpc.Core.GrpcEnvironment.html
> [2]: 
> https://github.com/grpc/grpc/blob/c1349090872753dcafbb03789bb3417f6d4b2849/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs
> [3]: 
> https://github.com/grpc/grpc/blob/c1349090872753dcafbb03789bb3417f6d4b2849/src/csharp/Grpc.Core/GrpcEnvironment.cs#L198-L249
>
> --
> Christopher Warrington
> Microsoft Corp.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/9ec5e880-85a0-43f4-99ea-8a01c5baf754%40googlegroups.com.

Reply via email to