summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ydb/core/driver_lib/run/run.cpp34
-rw-r--r--ydb/core/protos/config.proto17
-rw-r--r--ydb/library/grpc/server/grpc_server.h2
3 files changed, 53 insertions, 0 deletions
diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp
index 70eb9987ca4..05fd3b4c9e0 100644
--- a/ydb/core/driver_lib/run/run.cpp
+++ b/ydb/core/driver_lib/run/run.cpp
@@ -947,6 +947,40 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
opts.SetMaxMessageSize(grpcConfig.HasMaxMessageSize() ? grpcConfig.GetMaxMessageSize() : NYdbGrpc::DEFAULT_GRPC_MESSAGE_SIZE_LIMIT);
opts.SetMaxGlobalRequestInFlight(grpcConfig.GetMaxInFlight());
opts.SetLogger(NYdbGrpc::CreateActorSystemLogger(*ActorSystem.Get(), NKikimrServices::GRPC_SERVER));
+ switch(grpcConfig.GetDefaultCompressionAlgorithm()) {
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_NONE: {
+ opts.SetDefaultCompressionAlgorithm(GRPC_COMPRESS_NONE);
+ break;
+ }
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_DEFLATE: {
+ opts.SetDefaultCompressionAlgorithm(GRPC_COMPRESS_DEFLATE);
+ break;
+ }
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_GZIP: {
+ opts.SetDefaultCompressionAlgorithm(GRPC_COMPRESS_GZIP);
+ break;
+ }
+ }
+
+ switch(grpcConfig.GetDefaultCompressionLevel()) {
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_LEVEL_NONE: {
+ opts.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_NONE);
+ break;
+ }
+
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_LEVEL_LOW: {
+ opts.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_LOW);
+ break;
+ }
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_LEVEL_MED: {
+ opts.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_MED);
+ break;
+ }
+ case NKikimrConfig::TGRpcConfig::YDB_GRPC_COMPRESS_LEVEL_HIGH: {
+ opts.SetDefaultCompressionLevel(GRPC_COMPRESS_LEVEL_HIGH);
+ break;
+ }
+ }
if (appConfig.HasDomainsConfig() &&
appConfig.GetDomainsConfig().HasSecurityConfig() &&
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index 854a07179c8..ac4b45d8736 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -718,6 +718,23 @@ message TGRpcConfig {
repeated string RatelimiterServicesEnabled = 25;
repeated string RatelimiterServicesDisabled = 26;
+ enum YdbGrpcCompressionAlgorithm {
+ YDB_GRPC_COMPRESS_NONE = 0;
+ YDB_GRPC_COMPRESS_DEFLATE = 1;
+ YDB_GRPC_COMPRESS_GZIP = 2;
+ };
+
+ optional YdbGrpcCompressionAlgorithm DefaultCompressionAlgorithm = 30 [default = YDB_GRPC_COMPRESS_NONE];
+
+ enum YdbGrpcCompressionLevel {
+ YDB_GRPC_COMPRESS_LEVEL_NONE = 0;
+ YDB_GRPC_COMPRESS_LEVEL_LOW = 1;
+ YDB_GRPC_COMPRESS_LEVEL_MED = 2;
+ YDB_GRPC_COMPRESS_LEVEL_HIGH = 3;
+ }
+
+ optional YdbGrpcCompressionLevel DefaultCompressionLevel = 31 [default = YDB_GRPC_COMPRESS_LEVEL_NONE];
+
// server socket options
optional bool KeepAliveEnable = 100 [default = true]; // SO_KEEPALIVE
optional uint32 KeepAliveIdleTimeoutTriggerSec = 101 [default = 90]; // TCP_KEEPIDLE
diff --git a/ydb/library/grpc/server/grpc_server.h b/ydb/library/grpc/server/grpc_server.h
index f09dc3ecaf6..6777271b45e 100644
--- a/ydb/library/grpc/server/grpc_server.h
+++ b/ydb/library/grpc/server/grpc_server.h
@@ -104,6 +104,8 @@ struct TServerOptions {
// Mapping to particular compression algorithm depends on client.
DECLARE_FIELD(DefaultCompressionLevel, grpc_compression_level, GRPC_COMPRESS_LEVEL_NONE);
+ DECLARE_FIELD(DefaultCompressionAlgorithm, grpc_compression_algorithm, GRPC_COMPRESS_NONE);
+
//! Custom configurator for ServerBuilder.
DECLARE_FIELD(ServerBuilderMutator, std::function<void(grpc::ServerBuilder&)>, [](grpc::ServerBuilder&){});