diff options
-rw-r--r-- | library/cpp/grpc/server/grpc_server.cpp | 16 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_server.h | 3 | ||||
-rw-r--r-- | ydb/core/driver_lib/run/run.cpp | 1 | ||||
-rw-r--r-- | ydb/core/protos/config.proto | 1 |
4 files changed, 15 insertions, 6 deletions
diff --git a/library/cpp/grpc/server/grpc_server.cpp b/library/cpp/grpc/server/grpc_server.cpp index 0c05c7404e..ed69142882 100644 --- a/library/cpp/grpc/server/grpc_server.cpp +++ b/library/cpp/grpc/server/grpc_server.cpp @@ -145,13 +145,17 @@ void TGRpcServer::Start() { if (Options_.GRpcMemoryQuotaBytes) { // See details KIKIMR-6932 - /* - grpc::ResourceQuota quota("memory_bound"); - quota.Resize(Options_.GRpcMemoryQuotaBytes); + if (Options_.EnableGRpcMemoryQuota) { + grpc::ResourceQuota quota("memory_bound"); + quota.Resize(Options_.GRpcMemoryQuotaBytes); - builder.SetResourceQuota(quota); - */ - Cerr << "GRpc memory quota temporarily disabled due to issues with grpc quoter" << Endl; + builder.SetResourceQuota(quota); + + Cerr << "Set GRpc memory quota to: " << Options_.GRpcMemoryQuotaBytes << Endl; + } else { + Cerr << "GRpc memory quota was set but disabled due to issues with grpc quoter" + ", to enable it use EnableGRpcMemoryQuota option" << Endl; + } } Options_.ServerBuilderMutator(builder); builder.SetDefaultCompressionLevel(Options_.DefaultCompressionLevel); diff --git a/library/cpp/grpc/server/grpc_server.h b/library/cpp/grpc/server/grpc_server.h index 6da5076046..fb2726582c 100644 --- a/library/cpp/grpc/server/grpc_server.h +++ b/library/cpp/grpc/server/grpc_server.h @@ -67,6 +67,9 @@ struct TServerOptions { //! Memory quota size for grpc server in bytes. Zero means unlimited. DECLARE_FIELD(GRpcMemoryQuotaBytes, size_t, 0); + //! Enable Grpc memory quota feature. + DECLARE_FIELD(EnableGRpcMemoryQuota, bool, false); + //! How long to wait until pending rpcs are forcefully terminated. DECLARE_FIELD(GRpcShutdownDeadline, TDuration, TDuration::Seconds(30)); diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp index 9427b911ec..55e3a24747 100644 --- a/ydb/core/driver_lib/run/run.cpp +++ b/ydb/core/driver_lib/run/run.cpp @@ -843,6 +843,7 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) { opts.SetWorkerThreads(grpcConfig.GetWorkerThreads()); opts.SetWorkersPerCompletionQueue(grpcConfig.GetWorkersPerCompletionQueue()); opts.SetGRpcMemoryQuotaBytes(grpcConfig.GetGRpcMemoryQuotaBytes()); + opts.SetEnableGRpcMemoryQuota(grpcConfig.GetEnableGRpcMemoryQuota()); opts.SetMaxMessageSize(grpcConfig.HasMaxMessageSize() ? grpcConfig.GetMaxMessageSize() : DEFAULT_GRPC_MESSAGE_SIZE_LIMIT); opts.SetMaxGlobalRequestInFlight(grpcConfig.GetMaxInFlight()); opts.SetLogger(NGrpc::CreateActorSystemLogger(*ActorSystem.Get(), NKikimrServices::GRPC_SERVER)); diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto index ca7d75740a..0c24e9c9ce 100644 --- a/ydb/core/protos/config.proto +++ b/ydb/core/protos/config.proto @@ -672,6 +672,7 @@ message TGRpcConfig { optional uint32 HandlersPerCompletionQueue = 105 [default = 10]; optional uint32 GRpcProxyCount = 106 [default = 2]; + optional bool EnableGRpcMemoryQuota = 107 [default = false]; repeated TGRpcConfig ExtEndpoints = 200; // run specific services on separate endpoints } |