Memory usage and grpc::ResourceQuota

571 views
Skip to first unread message

Alex Zuo

unread,
Jul 28, 2021, 9:17:41 PM7/28/21
to grpc.io
I am writing an async grpc server, and I want to control the total memory it may use. Looks like that grpc::ResourceQuota is useful, but by checking the places where it is called, it seems that we only check memory quota when accepting a new connection.

What if a client keeps sending API calls through the same connection? The async gRPC server won't be able to handle them quickly. Where will they be buffered? When I say the server cannot handle them quickly, I mean RequestSayHello is not even called in the following Helloworld sample code.

void Proceed() {
if (status_ == CREATE) {
// Make this instance progress to the PROCESS state.
status_ = PROCESS;

// As part of the initial CREATE state, we *request* that the system
// start processing SayHello requests. In this request, "this" acts are
// the tag uniquely identifying the request (so that different CallData
// instances can serve different requests concurrently), in this case
// the memory address of this CallData instance.
std::cout << "ready to accept one request" << std::endl;
service_->RequestSayHello(&ctx_, &request_, &responder_, cq_, cq_,
this);

Craig Tiller

unread,
Jul 28, 2021, 10:24:29 PM7/28/21
to Alex Zuo, grpc.io
ResourceQuota right now will track some but as you discovered certainly not all of the memory used by gRPC.

The current behavior has been sufficient at Google to prevent some mishaps, but it's certainly not bulletproof.

We'll be looking into improving this in the future.

--
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/173872e1-1b52-4e4c-8fd9-d8383925da7fn%40googlegroups.com.

Lixin Wei

unread,
Aug 7, 2022, 11:34:20 PM8/7/22
to grpc.io
I also met the same problem: can't control the memory of one connection, causing OOM in my system.


Are there any enhancements now?
Reply all
Reply to author
Forward
0 new messages