How does golang grpc implementation handle the server concurrency?
One goroutine per method call? Or sort of goroutine pool?
Does it depend on the concurrency model of net/http2?
Multiple gRPC clients can be created from a channel, including different types of clients. A channel and clients created from the channel can safely be used by multiple threads. Clients created from the channel can make multiple simultaneous calls.
Additionally, a gRPC RPC can be synchronous or asynchronous. Synchronous: a client call waits for the server to respond. Asynchronous: client makes non-blocking calls to the server, and the server returns the response asynchronously.
In gRPC, the client triggers communication, which consists of request headers, binary messages (this is known as a length-prefixed message), and end-of-stream flag to notify the server that the client finished sending the content.
gRPC builds on top of this foundation with connection pooling, health semantics, efficient use of data frames and multiplexing, and KeepAlive. Developers choosing protocols must choose those that meet today's demands as well as tomorrow's.
One goroutine per method call. There's current no goroutine pool for service handlers.
It doesn't depend on net/http2 concurrency model.
https://github.com/grpc/grpc-go/blob/master/Documentation/concurrency.md#servers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With