Hello,
I am very interested in the gRPC bi-directional streaming feature. I have a few questions on the server side. In the .proto file, I define a simple streaming RPC and message below
service MfMessaging {
rpc MfRpc (stream MfStream) returns (stream MfStream) {}
}
message MfStream {
bytes message=1;
}
My first question is: what is the thread model at server side? I mean how gRPC handles if there are multiple concurrent requests from different clients? Does gRPC spawn a thread for each client? If yes, is there any limit or gRPC has a thread pool underneath?
My second question is: In the service routine, I get a ServerReaderWriter stream (e.g. ServerReaderWriter<MfStream, MfStream>* stream). What is lifetime of this stream? Can I pass this stream to another thread which writes response back later?
Look forward to your reply. Thank you very much!