From f58e66f4801b25250b3da9e8643c1002fcb452c5 Mon Sep 17 00:00:00 2001 From: Vitalii Gridnev Date: Fri, 16 Aug 2024 14:44:45 +0300 Subject: [PATCH] allow to configure min alloc size --- ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp | 6 ++++++ ydb/core/kqp/node_service/kqp_node_service.cpp | 2 ++ ydb/core/protos/table_service_config.proto | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp b/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp index 427d958a1bc7..f7efc87d0f47 100644 --- a/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp +++ b/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp @@ -86,6 +86,8 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory { std::atomic MkqlLightProgramMemoryLimit = 0; std::atomic MkqlHeavyProgramMemoryLimit = 0; std::atomic MinChannelBufferSize = 0; + std::atomic MinMemAllocSize = 8_MB; + std::atomic MinMemFreeSize = 32_MB; public: TKqpCaFactory(const NKikimrConfig::TTableServiceConfig::TResourceManager& config, @@ -104,6 +106,8 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory { MkqlLightProgramMemoryLimit.store(config.GetMkqlLightProgramMemoryLimit()); MkqlHeavyProgramMemoryLimit.store(config.GetMkqlHeavyProgramMemoryLimit()); MinChannelBufferSize.store(config.GetMinChannelBufferSize()); + MinMemAllocSize.store(config.GetMinMemAllocSize()); + MinMemFreeSize.store(config.GetMinMemFreeSize()); } TActorStartResult CreateKqpComputeActor(TCreateArgs&& args) override { @@ -111,6 +115,8 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory { memoryLimits.ChannelBufferSize = 0; memoryLimits.MkqlLightProgramMemoryLimit = MkqlLightProgramMemoryLimit.load(); memoryLimits.MkqlHeavyProgramMemoryLimit = MkqlHeavyProgramMemoryLimit.load(); + memoryLimits.MinMemAllocSize = MinMemAllocSize.load(); + memoryLimits.MinMemFreeSize = MinMemFreeSize.load(); auto estimation = ResourceManager_->EstimateTaskResources(*args.Task, args.NumberOfTasks); NRm::TKqpResourcesRequest resourcesRequest; diff --git a/ydb/core/kqp/node_service/kqp_node_service.cpp b/ydb/core/kqp/node_service/kqp_node_service.cpp index 3c0c90df78cc..27b6396f26f6 100644 --- a/ydb/core/kqp/node_service/kqp_node_service.cpp +++ b/ydb/core/kqp/node_service/kqp_node_service.cpp @@ -378,6 +378,8 @@ class TKqpNodeService : public TActorBootstrapped { FORCE_VALUE(PublishStatisticsIntervalSec); FORCE_VALUE(MaxTotalChannelBuffersSize); FORCE_VALUE(MinChannelBufferSize); + FORCE_VALUE(MinMemAllocSize); + FORCE_VALUE(MinMemFreeSize); #undef FORCE_VALUE LOG_I("Updated table service config: " << Config.DebugString()); diff --git a/ydb/core/protos/table_service_config.proto b/ydb/core/protos/table_service_config.proto index 4ee8ec7bf4ad..b2bdb6abdadb 100644 --- a/ydb/core/protos/table_service_config.proto +++ b/ydb/core/protos/table_service_config.proto @@ -23,7 +23,7 @@ message TTableServiceConfig { optional uint32 ComputeActorsCount = 1 [default = 10000]; optional uint64 ChannelBufferSize = 2 [default = 8388608]; // 8 MB reserved 3; - optional uint64 MkqlLightProgramMemoryLimit = 4 [default = 524288]; // 512 KB + optional uint64 MkqlLightProgramMemoryLimit = 4 [default = 1048576]; // 1 MiB optional uint64 MkqlHeavyProgramMemoryLimit = 5 [default = 31457280]; // 30 MB optional uint64 QueryMemoryLimit = 6 [default = 32212254720]; // 30 GB optional uint32 PublishStatisticsIntervalSec = 7 [default = 2]; @@ -43,6 +43,9 @@ message TTableServiceConfig { optional uint64 KqpPatternCachePatternAccessTimesBeforeTryToCompile = 20 [default = 5]; optional uint64 KqpPatternCacheCompiledCapacityBytes = 21 [default = 104857600]; // 100 MiB optional double SpillingPercent = 22 [default = 80]; // 100 MiB + + optional uint64 MinMemAllocSize = 23 [default = 8388608]; // 8 MiB + optional uint64 MinMemFreeSize = 24 [default = 33554432]; // 32 MiB } message TSpillingServiceConfig {