Skip to content

Commit ec98756

Browse files
authored
Merge to 24-3: fix harmonizer logic with hoggish pools (ydb-platform#9477)
1 parent 590ac64 commit ec98756

11 files changed

+634
-169
lines changed

ydb/library/actors/core/executor_pool.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace NActors {
1515
class ISchedulerCookie;
1616

1717
struct TCpuConsumption {
18-
double ConsumedUs = 0;
19-
double BookedUs = 0;
18+
double ElapsedUs = 0;
19+
double CpuUs = 0;
2020
ui64 NotEnoughCpuExecutions = 0;
2121

2222
void Add(const TCpuConsumption& other) {
23-
ConsumedUs += other.ConsumedUs;
24-
BookedUs += other.BookedUs;
23+
ElapsedUs += other.ElapsedUs;
24+
CpuUs += other.CpuUs;
2525
NotEnoughCpuExecutions += other.NotEnoughCpuExecutions;
2626
}
2727
};

ydb/library/actors/core/executor_pool_basic.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,10 @@ namespace NActors {
408408
poolStats.DecreasingThreadsByHoggishState = stats.DecreasingThreadsByHoggishState;
409409
poolStats.DecreasingThreadsByExchange = stats.DecreasingThreadsByExchange;
410410
poolStats.PotentialMaxThreadCount = stats.PotentialMaxThreadCount;
411-
poolStats.MaxConsumedCpuUs = stats.MaxConsumedCpu;
412-
poolStats.MinConsumedCpuUs = stats.MinConsumedCpu;
413-
poolStats.MaxBookedCpuUs = stats.MaxBookedCpu;
414-
poolStats.MinBookedCpuUs = stats.MinBookedCpu;
411+
poolStats.MaxElapsedCpuUs = stats.MaxElapsedCpu;
412+
poolStats.MinElapsedCpuUs = stats.MinElapsedCpu;
413+
poolStats.MaxCpuUs = stats.MaxCpu;
414+
poolStats.MinCpuUs = stats.MinCpu;
415415
}
416416

417417
statsCopy.resize(MaxFullThreadCount + 1);
@@ -430,7 +430,7 @@ namespace NActors {
430430
void TBasicExecutorPool::GetExecutorPoolState(TExecutorPoolState &poolState) const {
431431
if (Harmonizer) {
432432
TPoolHarmonizerStats stats = Harmonizer->GetPoolStats(PoolId);
433-
poolState.UsedCpu = stats.AvgConsumedCpu;
433+
poolState.UsedCpu = stats.AvgElapsedCpu;
434434
poolState.PossibleMaxLimit = stats.PotentialMaxThreadCount;
435435
} else {
436436
poolState.PossibleMaxLimit = poolState.MaxLimit;

ydb/library/actors/core/executor_pool_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ namespace NActors {
140140

141141
void TIOExecutorPool::GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const {
142142
poolStats.CurrentThreadCount = PoolThreads;
143-
poolStats.DefaultThreadCount = PoolThreads;
143+
poolStats.DefaultThreadCount = 0;
144144
poolStats.MaxThreadCount = PoolThreads;
145145
poolStats.PotentialMaxThreadCount = PoolThreads;
146146
statsCopy.resize(PoolThreads + 1);
@@ -156,7 +156,7 @@ namespace NActors {
156156
void TIOExecutorPool::GetExecutorPoolState(TExecutorPoolState &poolState) const {
157157
if (Harmonizer) {
158158
TPoolHarmonizerStats stats = Harmonizer->GetPoolStats(PoolId);
159-
poolState.UsedCpu = stats.AvgConsumedCpu;
159+
poolState.UsedCpu = stats.AvgElapsedCpu;
160160
}
161161
poolState.CurrentLimit = PoolThreads;
162162
poolState.MaxLimit = PoolThreads;

ydb/library/actors/core/executor_pool_shared.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,16 @@ void TSharedExecutorPool::GiveHalfThread(i16 from, i16 to) {
143143
}
144144

145145
void TSharedExecutorPool::GetSharedStats(i16 poolId, std::vector<TExecutorThreadStats>& statsCopy) {
146-
statsCopy.resize(SharedThreadCount + 1);
146+
statsCopy.resize(SharedThreadCount);
147147
for (i16 i = 0; i < SharedThreadCount; ++i) {
148-
Threads[i].Thread->GetSharedStats(poolId, statsCopy[i + 1]);
148+
Threads[i].Thread->GetSharedStats(poolId, statsCopy[i]);
149149
}
150150
}
151151

152152
void TSharedExecutorPool::GetSharedStatsForHarmonizer(i16 poolId, std::vector<TExecutorThreadStats>& statsCopy) {
153-
statsCopy.resize(SharedThreadCount + 1);
153+
statsCopy.resize(SharedThreadCount);
154154
for (i16 i = 0; i < SharedThreadCount; ++i) {
155-
Threads[i].Thread->GetSharedStatsForHarmonizer(poolId, statsCopy[i + 1]);
155+
Threads[i].Thread->GetSharedStatsForHarmonizer(poolId, statsCopy[i]);
156156
}
157157
}
158158

0 commit comments

Comments
 (0)