dsdtszi0520538 2019-08-06 11:46 采纳率: 100%
浏览 1188


I would like to know, how flow control works in a client-streaming gRPC service in Go.

Specifically, I am interested in knowing when will a call to stream.SendMsg() function in the client-side block? According to the documentation :

SendMsg() blocks until :

  • There is sufficient flow control to schedule m with the transport, or ...

So what is the specification for the flow control mechanism of the stream? For example, if the server-side code responsible for reading the messages from the stream, isn't reading the messages fast enough, at what point will calls to SendMsg() block?

Is there some kind of backpressure mechanism implemented for the server to tell the client that it is not ready to receive more data? In the meantime, where are all the messages that have been successfully sent before the backpressure signal, queued?

  • 写回答

1条回答 默认 最新

  • douyan8027 2019-08-07 20:19

    gRPC flow control is based on http2 flow control: https://http2.github.io/http2-spec/#FlowControl

    There will be backpressure. Messages are only successfully sent when there's enough flow control window for them, otherwise SendMsg() will block.

    The signal from the receiving side is not to add backpressure, it's to release backpressure. It's like saying "now I'm ready to receive another 1MB of messages, send them".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥30 电脑误删了手机的照片怎么恢复?
  • ¥15 (标签-python|关键词-char)
  • ¥15 python+selenium,在新增时弹出了一个输入框
  • ¥15 苹果验机结果的api接口哪里有??单次调用1毛钱及以下。
  • ¥20 学生成绩管理系统设计
  • ¥15 来一个cc穿盾脚本开发者
  • ¥15 CST2023安装报错
  • ¥15 使用diffusionbert生成文字 结果是PAD和UNK怎么办
  • ¥15 有人懂怎么做大模型的客服系统吗?卡住了卡住了
  • ¥20 firefly-rk3399上启动卡住了