Hi, It helps to adopt streaming calls. gRPC C++ server will only cache 1 message and apply flow control on this stream. For an existing application, this could mean compacting multiple service methods into one.
If above is not possible, you can consider to tune channel args (https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/grpc_types.h): 1. Limit the concurrent streams via `grpc.max_concurrent_streams` 2. Limit the per stream buffer size via `GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE On Saturday, May 28, 2022 at 8:54:11 AM UTC-7 [email protected] wrote: > Hi everyone! > > I just find that in C++, when using AsyncService, even if I don't request > a new request, gRPC will still read data from the network. This caused a > huge memory usage in my system. > > Detailed Scenario: > > I have a client that will send a lot of requests to the server. > > On the server-side, I didn't request any requests. The server blocked in > cq_->Next(&tag, &ok) but was kept consuming memory. Caused an OOM in my > system. > > So my question is how to prevent the server from reading data from the > network when I don't request a new request? i.e. how to do server-side > backpressure so I can save the memory?? > > Could anyone help me? thanks! > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/c0b01c89-a7c6-441d-92ef-f2706555e797n%40googlegroups.com.
