Memory usage and grpc::ResourceQuota

Skip to first unread message

Alex Zuo

Jul 28, 2021, 9:17:41 PM7/28/21
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_,

Craig Tiller

Jul 28, 2021, 10:24:29 PM7/28/21
to Alex Zuo,
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 "" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Lixin Wei

Aug 7, 2022, 11:34:20 PMAug 7
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
0 new messages