GRPC Asynchronous Streaming Write() Op in C++

36 views
Skip to first unread message

vinay Nayak

unread,
May 3, 2023, 10:55:18 AM5/3/23
to grpc.io
Hi ,
In GRPC Asynchronous Streaming , it is mentioned that we cannot do back to back write() on the same RPC Call and we can do next Write() only after getting back tag from completion queue.

Suppose if an application is multi threaded and if any given thread can do Write(), and we have to maintain a queue where all application threads adds messages into it and proceed with execution of next instructions and grpc[client/server] thread reads from it each time a tag is received from Completion queue and sends to peer service. This way, it adds latency in the communication of messages between services. Is this expected behavior ?

Is there any better way of doing it ?

veb...@google.com

unread,
May 4, 2023, 7:15:34 PM5/4/23
to grpc.io
Your understanding is correct but this doesn't necessarily mean that it increases unnecessary latency. gRPC does this for flow control, otherwise the receiver will be overflown by excessive messages. Another thing you can try is to establish multiple connections because some environment can have a throughput limit per connection.
Reply all
Reply to author
Forward
0 new messages