diff options
author | dcherednik <dcherednik@ydb.tech> | 2023-03-02 15:50:11 +0300 |
---|---|---|
committer | dcherednik <dcherednik@ydb.tech> | 2023-03-02 15:50:11 +0300 |
commit | 495429833643392f7c357eb2b077fcf90696201e (patch) | |
tree | de7767f3db825470848815fc2dd887def11b527c /library/cpp | |
parent | b0c0cfeece895dfee2397f7344920ccd90252cea (diff) | |
download | ydb-495429833643392f7c357eb2b077fcf90696201e.tar.gz |
Feature flag to enable grpc memory quota.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/grpc/server/grpc_server.cpp | 16 | ||||
-rw-r--r-- | library/cpp/grpc/server/grpc_server.h | 3 |
2 files changed, 13 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)); |