From 323c6a8ef77eb55838a31f377acda935e38e5d9e Mon Sep 17 00:00:00 2001 From: Vitalii Gridnev Date: Mon, 19 Aug 2024 12:31:29 +0300 Subject: [PATCH] allow to configure min alloc size (#7951) --- ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp | 8 +++++++- ydb/core/kqp/node_service/kqp_node_service.cpp | 2 ++ ydb/core/protos/table_service_config.proto | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) 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 ca920e7112df..4cb5c3d1d97f 100644 --- a/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp +++ b/ydb/core/kqp/compute_actor/kqp_compute_actor_factory.cpp @@ -89,6 +89,8 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory { std::atomic MkqlHeavyProgramMemoryLimit = 0; std::atomic MinChannelBufferSize = 0; std::atomic ReasonableSpillingTreshold = 0; + std::atomic MinMemAllocSize = 8_MB; + std::atomic MinMemFreeSize = 32_MB; public: TKqpCaFactory(const NKikimrConfig::TTableServiceConfig::TResourceManager& config, @@ -108,6 +110,8 @@ class TKqpCaFactory : public IKqpNodeComputeActorFactory { MkqlHeavyProgramMemoryLimit.store(config.GetMkqlHeavyProgramMemoryLimit()); MinChannelBufferSize.store(config.GetMinChannelBufferSize()); ReasonableSpillingTreshold.store(config.GetReasonableSpillingTreshold()); + MinMemAllocSize.store(config.GetMinMemAllocSize()); + MinMemFreeSize.store(config.GetMinMemFreeSize()); } TActorStartResult CreateKqpComputeActor(TCreateArgs&& args) { @@ -115,6 +119,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; @@ -232,4 +238,4 @@ std::shared_ptr MakeKqpCaFactory(const NKikimrConfi return std::make_shared(config, resourceManager, asyncIoFactory, federatedQuerySetup); } -} \ No newline at end of file +} diff --git a/ydb/core/kqp/node_service/kqp_node_service.cpp b/ydb/core/kqp/node_service/kqp_node_service.cpp index 5babf184cbaa..78ec3ab72022 100644 --- a/ydb/core/kqp/node_service/kqp_node_service.cpp +++ b/ydb/core/kqp/node_service/kqp_node_service.cpp @@ -329,6 +329,8 @@ class TKqpNodeService : public TActorBootstrapped { FORCE_VALUE(EnableInstantMkqlMemoryAlloc); 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 39de464b7d15..78bf300c60a0 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 uint64 ReasonableSpillingTreshold = 22 [default = 104857600]; // 100 MiB + + optional uint64 MinMemAllocSize = 23 [default = 8388608]; // 8 MiB + optional uint64 MinMemFreeSize = 24 [default = 33554432]; // 32 MiB } message TSpillingServiceConfig {