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. 
> https://github.com/grpc/grpc-java/issues/9197
>
> 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() 
<https://grpc.github.io/grpc-java/javadoc/io/grpc/netty/NettyServerBuilder.html#flowControlWindow-int->
 (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 
<https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/manualflowcontrol/ManualFlowControlServer.java#L51>.
 
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.


 

-- 
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+unsubscr...@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.

Reply via email to