Manual control flow

127 views
Skip to first unread message

y

unread,
Dec 27, 2022, 6:16:03 PM12/27/22
to grpc.io
Hi,

We want to implement some manual control flow that are aware of memory size..

From this post, it seems the default client and server buffer size are pretty small. 

What's the recommended way or work around to control the buffer size during the high load? 

Another question is when OnReadyHandler will be called for bi-di streaming server? 

My understanding is:

For client side, it gets called the client side gets some buffer because the packet got sent out over the network. 

For server side, I am not sure when it is called? I understand there is some buffer in server side as well. so it is called when server side's message gets consumed? 


sanjay...@google.com

unread,
Dec 28, 2022, 1:33:16 PM12/28/22
to grpc.io
On Tuesday, December 27, 2022 at 3:16:03 PM UTC-8 liuya...@gmail.com wrote:
Hi,

We want to implement some manual control flow that are aware of memory size..

From this post, it seems the default client and server buffer size are pretty small. 

What's the recommended way or work around to control the buffer size during the high load? 

The cited link does talk about ability to set the receiver buffer size using flowControlWindow() (in both NettyServerBuilder and NettyClientBuilder) although the sender buffer size is fixed. Does that work?


Another question is when OnReadyHandler will be called for bi-di streaming server? 

My understanding is:

For client side, it gets called the client side gets some buffer because the packet got sent out over the network. 

For server side, I am not sure when it is called? I understand there is some buffer in server side as well. so it is called when server side's message gets consumed? 

Take a look at ManualFlowControlServer example. It says "The onReadyHandler will be invoked when the consuming side has enough buffer space to receive more messages." 

Further down it says "Signal the request sender to send one message. This happens when isReady() turns true, signaling that the receive buffer has enough free space to receive more messages."

Hope that helps.


 

y

unread,
Dec 28, 2022, 4:10:42 PM12/28/22
to sanjay...@google.com, grpc.io
Thanks for helping.

Is ManualFlowControlClient.java  for controlling reply stream or request stream.

I understand flowControlWindow can change the receiver buffer.
And the sender buffer is fixed. Is there a recommended way to work around the fixed sender buffer? 



--
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 grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/42f9f8cb-84d7-4cf0-bfef-0f133c8f5920n%40googlegroups.com.

Sanjay Pujare

unread,
Dec 28, 2022, 4:20:17 PM12/28/22
to y, grpc.io
Thanks for helping.

Is ManualFlowControlClient.java  for controlling reply stream or request stream.

To control the response stream (from line 97). But it also does the request stream management through the onReadyHandler (lines 77-87)
 

I understand flowControlWindow can change the receiver buffer.
And the sender buffer is fixed. Is there a recommended way to work around the fixed sender buffer? 

Not that I am aware of. Maybe there are other ways to achieve what you want?
Reply all
Reply to author
Forward
0 new messages