Skip to content

Commit

Permalink
Implement discrete pool weights (#9839)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssmike authored Nov 29, 2024
1 parent dda2bc2 commit fed45b0
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 43 deletions.
3 changes: 3 additions & 0 deletions ydb/core/kqp/executer_actor/kqp_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ std::unique_ptr<TEvKqpNode::TEvStartKqpTasksRequest> TKqpPlanner::SerializeReque
if (UserRequestContext->PoolConfig->QueryCpuLimitPercentPerNode >= 0) {
request.SetQueryCpuShare(UserRequestContext->PoolConfig->QueryCpuLimitPercentPerNode / 100.0);
}
if (UserRequestContext->PoolConfig->ResourceWeight >= 0) {
request.SetResourceWeight(UserRequestContext->PoolConfig->ResourceWeight);
}
}

return result;
Expand Down
11 changes: 8 additions & 3 deletions ydb/core/kqp/node_service/kqp_node_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,17 @@ class TKqpNodeService : public TActorBootstrapped<TKqpNodeService> {

if (SchedulerOptions.Scheduler->Disabled(schedulerGroup)) {
auto share = msg.GetPoolMaxCpuShare();
if (share <= 0 && msg.HasQueryCpuShare()) {
if (share <= 0 && (msg.HasQueryCpuShare() || msg.HasResourceWeight())) {
share = 1.0;
}
std::optional<double> resourceWeight;
if (msg.GetResourceWeight() >= 0) {
resourceWeight = msg.GetResourceWeight();
}

if (share > 0) {
Scheduler->UpdateGroupShare(schedulerGroup, share, schedulerNow);
Send(SchedulerActorId, new TEvSchedulerNewPool(msg.GetDatabaseId(), schedulerGroup));
Scheduler->UpdateGroupShare(schedulerGroup, share, schedulerNow, resourceWeight);
Send(SchedulerActorId, new TEvSchedulerNewPool(msg.GetDatabase(), schedulerGroup));
} else {
schedulerGroup = "";
}
Expand Down
Loading

0 comments on commit fed45b0

Please sign in to comment.