Skip to content

Commit

Permalink
[cherry-pick][core] Fix the GCS memory usage high issue (picks #32302) (
Browse files Browse the repository at this point in the history
#32330)

This cherry-picks #32302

Why are these changes needed?
It's not because of leak. The root cause is because we allocate more requests when start. This PR fixed it by making the number of call constant.
  • Loading branch information
fishbone authored Feb 8, 2023
1 parent d53bb83 commit f847ca1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ray/rpc/grpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ GrpcServer::GrpcServer(std::string name,
is_closed_(true),
num_threads_(num_threads),
keepalive_time_ms_(keepalive_time_ms) {
RAY_CHECK(num_threads_ > 0) << "Num of threads in gRPC must be greater than 0";
cqs_.resize(num_threads_);
// Enable built in health check implemented by gRPC:
// https://github.com/grpc/grpc/blob/master/doc/health-checking.md
Expand Down Expand Up @@ -148,7 +149,7 @@ void GrpcServer::Run() {
if (entry->GetMaxActiveRPCs() != -1) {
buffer_size = entry->GetMaxActiveRPCs();
}
for (int j = 0; j < buffer_size; j++) {
for (int j = 0; j < std::max(1, buffer_size / num_threads_); j++) {
entry->CreateCall();
}
}
Expand Down

0 comments on commit f847ca1

Please sign in to comment.