diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-02-09 20:08:13 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-02-09 20:08:13 +0300 |
commit | a85c44eb1ea1fca38714bb905b2a64a79dc603b4 (patch) | |
tree | 85c81b1be0baf1c764c531d97c153badd1ce77db | |
parent | 698b400d09b3c1c7aff6ebf986eb3dc3ced74a08 (diff) | |
download | ydb-a85c44eb1ea1fca38714bb905b2a64a79dc603b4.tar.gz |
dont use channels count as multiplication for resources usage prediction through real processed data size dont depends on channels count
-rw-r--r-- | ydb/core/kqp/executer_actor/kqp_planner.cpp | 2 | ||||
-rw-r--r-- | ydb/core/kqp/rm_service/kqp_resource_estimation.cpp | 8 | ||||
-rw-r--r-- | ydb/core/kqp/rm_service/kqp_resource_estimation_ut.cpp | 6 |
3 files changed, 6 insertions, 10 deletions
diff --git a/ydb/core/kqp/executer_actor/kqp_planner.cpp b/ydb/core/kqp/executer_actor/kqp_planner.cpp index cbbc58f8f6f..ba19402fd22 100644 --- a/ydb/core/kqp/executer_actor/kqp_planner.cpp +++ b/ydb/core/kqp/executer_actor/kqp_planner.cpp @@ -113,7 +113,7 @@ void TKqpPlanner::Process() { LOG_E("Not enough resources to execute query locally and no information about other nodes"); auto ev = MakeHolder<TEvKqp::TEvAbortExecution>(NYql::NDqProto::StatusIds::PRECONDITION_FAILED, - "Not enough resources to execute query locally and no information about other nodes"); + "Not enough resources to execute query locally and no information about other nodes (estimation: " + ToString(LocalRunMemoryEst) + ")"); TlsActivationContext->Send(std::make_unique<IEventHandle>(ExecuterId, ExecuterId, ev.Release())); return; diff --git a/ydb/core/kqp/rm_service/kqp_resource_estimation.cpp b/ydb/core/kqp/rm_service/kqp_resource_estimation.cpp index 2500c940203..cd96733a969 100644 --- a/ydb/core/kqp/rm_service/kqp_resource_estimation.cpp +++ b/ydb/core/kqp/rm_service/kqp_resource_estimation.cpp @@ -17,12 +17,8 @@ void EstimateTaskResources(const TDqTask& task, const TTableServiceConfig::TReso TTaskResourceEstimation& ret) { ret.TaskId = task.GetId(); - for (const auto& input : task.GetInputs()) { - ret.ChannelBuffersCount += input.ChannelsSize(); - } - for (const auto& output : task.GetOutputs()) { - ret.ChannelBuffersCount += output.ChannelsSize(); - } + ret.ChannelBuffersCount += task.GetInputs().size() ? 1 : 0; + ret.ChannelBuffersCount += task.GetOutputs().size() ? 1 : 0; ui64 channelBuffersSize = ret.ChannelBuffersCount * config.GetChannelBufferSize(); if (channelBuffersSize > config.GetMaxTotalChannelBuffersSize()) { diff --git a/ydb/core/kqp/rm_service/kqp_resource_estimation_ut.cpp b/ydb/core/kqp/rm_service/kqp_resource_estimation_ut.cpp index b4e75f7753f..64bb10bae36 100644 --- a/ydb/core/kqp/rm_service/kqp_resource_estimation_ut.cpp +++ b/ydb/core/kqp/rm_service/kqp_resource_estimation_ut.cpp @@ -32,7 +32,7 @@ Y_UNIT_TEST(TestChannelSize) { output->MutableChannels()->Add(); auto est = EstimateTaskResources(task, config); - UNIT_ASSERT_EQUAL(201, est.ChannelBuffersCount); + UNIT_ASSERT_EQUAL(2, est.ChannelBuffersCount); UNIT_ASSERT_EQUAL(est.ChannelBufferMemoryLimit, config.GetChannelBufferSize()); // add more channels, to be more then 256 @@ -42,9 +42,9 @@ Y_UNIT_TEST(TestChannelSize) { } est = EstimateTaskResources(task, config); - UNIT_ASSERT_EQUAL(301, est.ChannelBuffersCount); + UNIT_ASSERT_EQUAL(2, est.ChannelBuffersCount); - UNIT_ASSERT(est.ChannelBufferMemoryLimit < config.GetChannelBufferSize()); + UNIT_ASSERT(est.ChannelBufferMemoryLimit == config.GetChannelBufferSize()); UNIT_ASSERT(est.ChannelBufferMemoryLimit >= config.GetMinChannelBufferSize()); } |