Skip to content

Commit b378a82

Browse files
committed
Fix incorrect harmonizer behaviour with shared threads (#19295)
1 parent a5a96d9 commit b378a82

File tree

10 files changed

+202
-208
lines changed

10 files changed

+202
-208
lines changed

ydb/library/actors/core/cpu_manager.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ namespace NActors {
9393

9494
for (ui32 excIdx = 0; excIdx != ExecutorPoolCount; ++excIdx) {
9595
Executors[excIdx].Reset(CreateExecutorPool(excIdx));
96-
if (excIdx < Config.PingInfoByPool.size()) {
97-
Harmonizer->AddPool(Executors[excIdx].Get(), &Config.PingInfoByPool[excIdx]);
98-
} else {
99-
Harmonizer->AddPool(Executors[excIdx].Get());
100-
}
96+
bool ignoreThreads = dynamic_cast<TIOExecutorPool*>(Executors[excIdx].Get());
97+
TSelfPingInfo *pingInfo = (excIdx < Config.PingInfoByPool.size()) ? &Config.PingInfoByPool[excIdx] : nullptr;
98+
Harmonizer->AddPool(Executors[excIdx].Get(), pingInfo, ignoreThreads);
10199
}
102100
ACTORLIB_DEBUG(EDebugLevel::ActorSystem, "TCpuManager::Setup: created");
103101
}

ydb/library/actors/core/harmonizer/cpu_consumption.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace {
6262
} // namespace
6363

6464

65-
void THarmonizerCpuConsumption::Pull(const std::vector<std::unique_ptr<TPoolInfo>> &pools, const TSharedInfo&) {
65+
void THarmonizerCpuConsumption::Pull(const std::vector<std::unique_ptr<TPoolInfo>> &pools, const TSharedInfo& sharedInfo) {
6666
NeedyPools.clear();
6767
HoggishPools.clear();
6868
IsNeedyByPool.clear();
@@ -78,7 +78,7 @@ void THarmonizerCpuConsumption::Pull(const std::vector<std::unique_ptr<TPoolInfo
7878
LastSecondCpu = 0.0;
7979
for (size_t poolIdx = 0; poolIdx < pools.size(); ++poolIdx) {
8080
TPoolInfo& pool = *pools[poolIdx];
81-
TotalCores += pool.DefaultThreadCount;
81+
TotalCores += pool.ThreadQuota;
8282

8383
AdditionalThreads += Max(0, pool.GetFullThreadCount() - pool.DefaultFullThreadCount);
8484
float currentThreadCount = pool.GetThreadCount();
@@ -103,7 +103,7 @@ void THarmonizerCpuConsumption::Pull(const std::vector<std::unique_ptr<TPoolInfo
103103

104104
bool isHoggish = IsHoggish(PoolConsumption[poolIdx].Elapsed, currentThreadCount);
105105
if (isHoggish) {
106-
float freeCpu = std::max(currentThreadCount - PoolConsumption[poolIdx].Elapsed, currentThreadCount - PoolConsumption[poolIdx].LastSecondElapsed);
106+
float freeCpu = currentThreadCount - PoolConsumption[poolIdx].Elapsed;
107107
HoggishPools.push_back({poolIdx, freeCpu});
108108
}
109109

@@ -139,16 +139,14 @@ void THarmonizerCpuConsumption::Pull(const std::vector<std::unique_ptr<TPoolInfo
139139

140140
HARMONIZER_DEBUG_PRINT("NeedyPools", NeedyPools.size(), "HoggishPools", HoggishPools.size());
141141

142-
Budget = TotalCores - Max(Elapsed, LastSecondElapsed);
143-
BudgetInt = static_cast<i16>(Max(Budget, 0.0f));
142+
Budget = TotalCores - Elapsed;
143+
BudgetWithoutSharedCpu = Budget - sharedInfo.FreeCpu;
144+
Overbooked = -Budget;
145+
LostCpu = Max<float>(0.0f, Elapsed - Cpu);
144146
if (Budget < -0.1) {
145147
IsStarvedPresent = true;
146148
}
147-
Overbooked = Elapsed - Cpu;
148-
if (Overbooked < 0) {
149-
IsStarvedPresent = false;
150-
}
151-
HARMONIZER_DEBUG_PRINT("IsStarvedPresent", IsStarvedPresent, "Budget", Budget, "BudgetInt", BudgetInt, "Overbooked", Overbooked, "TotalCores", TotalCores, "Elapsed", Elapsed, "Cpu", Cpu, "LastSecondElapsed", LastSecondElapsed, "LastSecondCpu", LastSecondCpu);
149+
HARMONIZER_DEBUG_PRINT("IsStarvedPresent", IsStarvedPresent, "Budget", Budget, "Overbooked", Overbooked, "TotalCores", TotalCores, "Elapsed", Elapsed, "Cpu", Cpu, "LastSecondElapsed", LastSecondElapsed, "LastSecondCpu", LastSecondCpu);
152150
}
153151

154152
} // namespace NActors

ydb/library/actors/core/harmonizer/cpu_consumption.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ struct THarmonizerCpuConsumption {
2424
i16 StoppingThreads = 0;
2525
bool IsStarvedPresent = false;
2626
float Budget = 0.0;
27-
i16 BudgetInt = 0;
27+
float BudgetWithoutSharedCpu = 0.0;
2828
float Overbooked = 0.0;
29+
float LostCpu = 0.0;
2930

3031
float Elapsed = 0.0;
3132
float Cpu = 0.0;

ydb/library/actors/core/harmonizer/harmonizer.cpp

Lines changed: 84 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
namespace NActors {
3030

31-
31+
constexpr float kMinFreeCpuThreshold = 0.1;
3232

3333
LWTRACE_USING(ACTORLIB_PROVIDER);
3434

@@ -73,7 +73,7 @@ class THarmonizer: public IHarmonizer {
7373
double Rescale(double value) const;
7474
void Harmonize(ui64 ts) override;
7575
void DeclareEmergency(ui64 ts) override;
76-
void AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo) override;
76+
void AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo, bool ignoreFullThreadQuota = false) override;
7777
void Enable(bool enable) override;
7878
TPoolHarmonizerStats GetPoolStats(i16 poolId) const override;
7979
THarmonizerStats GetStats() const override;
@@ -103,10 +103,10 @@ void THarmonizer::PullStats(ui64 ts) {
103103

104104
WaitingInfo.Pull(Pools);
105105
if (Shared) {
106-
SharedInfo.Pull(*Shared);
106+
SharedInfo.Pull(Pools, *Shared);
107107
}
108108
CpuConsumption.Pull(Pools, SharedInfo);
109-
ProcessingBudget = CpuConsumption.Budget;
109+
ProcessingBudget = CpuConsumption.BudgetWithoutSharedCpu;
110110
}
111111

112112
void THarmonizer::ProcessWaitingStats() {
@@ -168,14 +168,17 @@ void THarmonizer::ProcessNeedyState() {
168168
}
169169
float threadCount = pool.GetFullThreadCount() + SharedInfo.CpuConsumption[needyPoolIdx].CpuQuota;
170170

171-
if (Shared && SharedInfo.ForeignThreadsAllowed[needyPoolIdx] == 0) {
172-
Shared->SetForeignThreadSlots(needyPoolIdx, static_cast<i16>(Pools.size()));
173-
CpuConsumption.IsNeedyByPool[needyPoolIdx] = false;
174-
} else if (ProcessingBudget >= 1.0 && threadCount + 1 <= pool.MaxFullThreadCount) {
171+
if (ProcessingBudget >= 1.0 && threadCount + 1 <= pool.MaxFullThreadCount && SharedInfo.FreeCpu < kMinFreeCpuThreshold) {
175172
pool.IncreasingThreadsByNeedyState.fetch_add(1, std::memory_order_relaxed);
176173
CpuConsumption.IsNeedyByPool[needyPoolIdx] = false;
177174
CpuConsumption.AdditionalThreads++;
178175
pool.SetFullThreadCount(threadCount + 1);
176+
if (Shared) {
177+
bool hasOwnSharedThread = SharedInfo.OwnedThreads[needyPoolIdx] != -1;
178+
i16 slots = pool.MaxThreadCount - threadCount - 1 - hasOwnSharedThread;
179+
i16 maxSlots = Shared->GetSharedThreadCount();
180+
Shared->SetForeignThreadSlots(needyPoolIdx, Min<i16>(slots, maxSlots));
181+
}
179182
ProcessingBudget -= 1.0;
180183
LWPROBE_WITH_DEBUG(HarmonizeOperation, needyPoolIdx, pool.Pool->GetName(), "increase by needs", threadCount + 1, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
181184
}
@@ -201,16 +204,16 @@ void THarmonizer::ProcessExchange() {
201204
size_t sumOfAdditionalThreads = CpuConsumption.AdditionalThreads;
202205
for (size_t needyPoolIdx : CpuConsumption.NeedyPools) {
203206
TPoolInfo &pool = *Pools[needyPoolIdx];
204-
i64 threadCount = pool.GetFullThreadCount();
207+
i64 fullThreadCount = pool.GetFullThreadCount();
208+
float threadCount = fullThreadCount + SharedInfo.CpuConsumption[needyPoolIdx].CpuQuota;
205209

206-
sumOfAdditionalThreads -= threadCount - pool.DefaultFullThreadCount;
210+
sumOfAdditionalThreads -= fullThreadCount - pool.DefaultFullThreadCount;
207211
if (sumOfAdditionalThreads < takingAwayThreads + 1) {
208212
break;
209213
}
210214

211-
if (Shared && SharedInfo.ForeignThreadsAllowed[needyPoolIdx] < static_cast<i16>(Pools.size())) {
212-
Shared->SetForeignThreadSlots(needyPoolIdx, static_cast<i16>(Pools.size()));
213-
CpuConsumption.IsNeedyByPool[needyPoolIdx] = false;
215+
if (threadCount + 1 > pool.MaxFullThreadCount) {
216+
continue;
214217
}
215218

216219
if (!CpuConsumption.IsNeedyByPool[needyPoolIdx]) {
@@ -219,7 +222,13 @@ void THarmonizer::ProcessExchange() {
219222
pool.IncreasingThreadsByExchange.fetch_add(1, std::memory_order_relaxed);
220223
CpuConsumption.IsNeedyByPool[needyPoolIdx] = false;
221224
takingAwayThreads++;
222-
pool.SetFullThreadCount(threadCount + 1);
225+
pool.SetFullThreadCount(fullThreadCount + 1);
226+
if (Shared) {
227+
bool hasOwnSharedThread = SharedInfo.OwnedThreads[needyPoolIdx] != -1;
228+
i16 slots = pool.MaxThreadCount - fullThreadCount - 1 - hasOwnSharedThread;
229+
i16 maxSlots = Shared->GetSharedThreadCount();
230+
Shared->SetForeignThreadSlots(needyPoolIdx, Min<i16>(slots, maxSlots));
231+
}
223232

224233
LWPROBE_WITH_DEBUG(HarmonizeOperation, needyPoolIdx, pool.Pool->GetName(), "increase by exchanging", threadCount + 1, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
225234
}
@@ -230,39 +239,48 @@ void THarmonizer::ProcessExchange() {
230239
}
231240

232241
TPoolInfo &pool = *Pools[poolIdx];
233-
size_t threadCount = pool.GetFullThreadCount();
234-
size_t additionalThreadsCount = Max<size_t>(0L, threadCount - pool.DefaultFullThreadCount);
242+
size_t fullThreadCount = pool.GetFullThreadCount();
243+
size_t additionalThreadsCount = Max<size_t>(0L, fullThreadCount - pool.DefaultFullThreadCount);
235244
size_t currentTakingAwayThreads = Min(additionalThreadsCount, takingAwayThreads);
236245

237246
if (!currentTakingAwayThreads) {
238247
continue;
239248
}
240249
takingAwayThreads -= currentTakingAwayThreads;
241-
pool.SetFullThreadCount(threadCount - currentTakingAwayThreads);
250+
pool.SetFullThreadCount(fullThreadCount - currentTakingAwayThreads);
251+
if (Shared) {
252+
bool hasOwnSharedThread = SharedInfo.OwnedThreads[poolIdx] != -1;
253+
i16 slots = pool.MaxThreadCount - fullThreadCount + currentTakingAwayThreads - hasOwnSharedThread;
254+
i16 maxSlots = Shared->GetSharedThreadCount();
255+
Shared->SetForeignThreadSlots(poolIdx, Min<i16>(slots, maxSlots));
256+
}
242257

243258
pool.DecreasingThreadsByExchange.fetch_add(currentTakingAwayThreads, std::memory_order_relaxed);
244-
LWPROBE_WITH_DEBUG(HarmonizeOperation, poolIdx, pool.Pool->GetName(), "decrease by exchanging", threadCount - currentTakingAwayThreads, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
259+
LWPROBE_WITH_DEBUG(HarmonizeOperation, poolIdx, pool.Pool->GetName(), "decrease by exchanging", fullThreadCount - currentTakingAwayThreads, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
245260
}
246261
}
247262

248263
void THarmonizer::ProcessHoggishState() {
249264
HARMONIZER_DEBUG_PRINT("ProcessHoggishState");
250265
for (auto &[hoggishPoolIdx, freeCpu] : CpuConsumption.HoggishPools) {
251266
TPoolInfo &pool = *Pools[hoggishPoolIdx];
252-
i64 threadCount = pool.GetFullThreadCount();
253-
if (threadCount > pool.MinFullThreadCount && freeCpu >= 1) {
267+
i64 fullThreadCount = pool.GetFullThreadCount();
268+
if (fullThreadCount > pool.MinFullThreadCount && freeCpu >= 1) {
254269
pool.DecreasingThreadsByHoggishState.fetch_add(1, std::memory_order_relaxed);
255-
pool.SetFullThreadCount(threadCount - 1);
256-
LWPROBE_WITH_DEBUG(HarmonizeOperation, hoggishPoolIdx, pool.Pool->GetName(), "decrease by hoggish", threadCount - 1, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
257-
}
258-
if (threadCount == pool.MinFullThreadCount && Shared && SharedInfo.ForeignThreadsAllowed[hoggishPoolIdx] != 0) {
259-
Shared->SetForeignThreadSlots(hoggishPoolIdx, 0);
270+
pool.SetFullThreadCount(fullThreadCount - 1);
271+
if (Shared) {
272+
bool hasOwnSharedThread = SharedInfo.OwnedThreads[hoggishPoolIdx] != -1;
273+
i16 slots = pool.MaxThreadCount - fullThreadCount + 1 - hasOwnSharedThread;
274+
i16 maxSlots = Shared->GetSharedThreadCount();
275+
Shared->SetForeignThreadSlots(hoggishPoolIdx, Min<i16>(slots, maxSlots));
276+
}
277+
LWPROBE_WITH_DEBUG(HarmonizeOperation, hoggishPoolIdx, pool.Pool->GetName(), "decrease by hoggish", fullThreadCount - 1, pool.DefaultFullThreadCount, pool.MaxFullThreadCount);
260278
}
261279
if (pool.BasicPool && pool.LocalQueueSize > pool.MinLocalQueueSize) {
262280
pool.LocalQueueSize = std::min<ui16>(pool.MinLocalQueueSize, pool.LocalQueueSize / 2);
263281
pool.BasicPool->SetLocalQueueSize(pool.LocalQueueSize);
264282
}
265-
HARMONIZER_DEBUG_PRINT("poolIdx", hoggishPoolIdx, "threadCount", threadCount, "pool.MinFullThreadCount", pool.MinFullThreadCount, "freeCpu", freeCpu);
283+
HARMONIZER_DEBUG_PRINT("poolIdx", hoggishPoolIdx, "threadCount", fullThreadCount, "pool.MinFullThreadCount", pool.MinFullThreadCount, "freeCpu", freeCpu);
266284
}
267285
}
268286

@@ -305,8 +323,37 @@ void THarmonizer::HarmonizeImpl(ui64 ts) {
305323

306324
for (size_t poolIdx = 0; poolIdx < Pools.size(); ++poolIdx) {
307325
TPoolInfo& pool = *Pools[poolIdx];
308-
pool.PotentialMaxThreadCount.store(std::min<i64>(pool.MaxThreadCount, static_cast<i64>(pool.GetThreadCount() + CpuConsumption.Budget)), std::memory_order_relaxed);
309-
HARMONIZER_DEBUG_PRINT(poolIdx, pool.Pool->GetName(), "potential max thread count", pool.PotentialMaxThreadCount.load(std::memory_order_relaxed), "budget", CpuConsumption.Budget, "thread count", pool.GetThreadCount());
326+
327+
float freeSharedCpu = SharedInfo.FreeCpu;
328+
float budgetWithoutSharedCpu = std::max<float>(0.0f, CpuConsumption.BudgetWithoutSharedCpu);
329+
330+
float possibleMaxSharedQuota = 0.0f;
331+
if (Shared) {
332+
bool hasOwnSharedThread = SharedInfo.OwnedThreads[poolIdx] != -1;
333+
i16 sharedThreads = std::min<i16>(SharedInfo.ForeignThreadsAllowed[poolIdx] + hasOwnSharedThread, SharedInfo.ThreadCount);
334+
float poolSharedElapsedCpu = SharedInfo.CpuConsumption[poolIdx].Elapsed;
335+
possibleMaxSharedQuota = std::min<float>(poolSharedElapsedCpu + freeSharedCpu, sharedThreads);
336+
}
337+
float threadCount = pool.GetFullThreadCount();
338+
float elapsedCpu = pool.ElapsedCpu.GetAvgPart();
339+
float parkedCpu = Max<float>(0.0f, threadCount - elapsedCpu);
340+
float budgetWithoutSharedAndParkedCpu = std::max<float>(0.0f, budgetWithoutSharedCpu - parkedCpu);
341+
i16 potentialMaxThreadCountWithoutSharedCpu = std::min<float>(pool.MaxThreadCount, threadCount + budgetWithoutSharedAndParkedCpu);
342+
float potentialMaxThreadCount = std::min<float>(pool.MaxThreadCount, potentialMaxThreadCountWithoutSharedCpu + possibleMaxSharedQuota);
343+
344+
pool.PotentialMaxThreadCount.store(potentialMaxThreadCount, std::memory_order_relaxed);
345+
HARMONIZER_DEBUG_PRINT(poolIdx, pool.Pool->GetName(),
346+
"budget: ", CpuConsumption.Budget,
347+
"free shared cpu: ", freeSharedCpu,
348+
"budget without shared cpu: ", budgetWithoutSharedCpu,
349+
"budget without shared and parked cpu: ", budgetWithoutSharedAndParkedCpu,
350+
"potential max thread count: ", potentialMaxThreadCount,
351+
"potential max thread count without shared cpu: ", potentialMaxThreadCountWithoutSharedCpu,
352+
"possible max shared quota: ", possibleMaxSharedQuota,
353+
"thread count: ", threadCount,
354+
"elapsed cpu: ", elapsedCpu,
355+
"parked cpu: ", parkedCpu
356+
);
310357
}
311358
}
312359

@@ -362,14 +409,16 @@ void THarmonizer::DeclareEmergency(ui64 ts) {
362409
NextHarmonizeTs = ts;
363410
}
364411

365-
void THarmonizer::AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo) {
412+
void THarmonizer::AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo, bool ignoreFullThreadQuota) {
366413
TGuard<TSpinLock> guard(Lock);
367414
Pools.emplace_back(new TPoolInfo);
368415
TPoolInfo &poolInfo = *Pools.back();
369416
poolInfo.Pool = pool;
370417
poolInfo.Shared = Shared;
371418
poolInfo.BasicPool = dynamic_cast<TBasicExecutorPool*>(pool);
419+
372420
poolInfo.DefaultThreadCount = pool->GetDefaultThreadCount();
421+
poolInfo.ThreadQuota = ignoreFullThreadQuota ? 0 : poolInfo.DefaultThreadCount;
373422
poolInfo.MinThreadCount = pool->GetMinThreadCount();
374423
poolInfo.MaxThreadCount = pool->GetMaxThreadCount();
375424
poolInfo.PotentialMaxThreadCount = poolInfo.MaxThreadCount;
@@ -381,6 +430,12 @@ void THarmonizer::AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo) {
381430
poolInfo.SharedInfo.resize(Shared ? Shared->GetSharedThreadCount() : 0);
382431
poolInfo.Priority = pool->GetPriority();
383432
pool->SetFullThreadCount(poolInfo.DefaultFullThreadCount);
433+
if (Shared) {
434+
TVector<i16> ownedThreads(Pools.size(), -1);
435+
Shared->FillOwnedThreads(ownedThreads);
436+
bool hasOwnSharedThread = ownedThreads[pool->PoolId] != -1;
437+
Shared->SetForeignThreadSlots(pool->PoolId, Min<i16>(poolInfo.MaxThreadCount - hasOwnSharedThread, Shared->GetSharedThreadCount()));
438+
}
384439
if (pingInfo) {
385440
poolInfo.AvgPingCounter = pingInfo->AvgPingCounter;
386441
poolInfo.AvgPingCounterWithSmallWindow = pingInfo->AvgPingCounterWithSmallWindow;
@@ -414,12 +469,6 @@ TPoolHarmonizerStats THarmonizer::GetPoolStats(i16 poolId) const {
414469
.DecreasingThreadsByStarvedState = pool.DecreasingThreadsByStarvedState.load(std::memory_order_relaxed),
415470
.DecreasingThreadsByHoggishState = pool.DecreasingThreadsByHoggishState.load(std::memory_order_relaxed),
416471
.DecreasingThreadsByExchange = pool.DecreasingThreadsByExchange.load(std::memory_order_relaxed),
417-
.ReceivedHalfThreadByNeedyState = pool.ReceivedHalfThreadByNeedyState.load(std::memory_order_relaxed),
418-
.GivenHalfThreadByOtherStarvedState = pool.GivenHalfThreadByOtherStarvedState.load(std::memory_order_relaxed),
419-
.GivenHalfThreadByHoggishState = pool.GivenHalfThreadByHoggishState.load(std::memory_order_relaxed),
420-
.GivenHalfThreadByOtherNeedyState = pool.GivenHalfThreadByOtherNeedyState.load(std::memory_order_relaxed),
421-
.ReturnedHalfThreadByStarvedState = pool.ReturnedHalfThreadByStarvedState.load(std::memory_order_relaxed),
422-
.ReturnedHalfThreadByOtherHoggishState = pool.ReturnedHalfThreadByOtherHoggishState.load(std::memory_order_relaxed),
423472
.MaxUsedCpu = pool.MaxUsedCpu.load(std::memory_order_relaxed),
424473
.MinUsedCpu = pool.MinUsedCpu.load(std::memory_order_relaxed),
425474
.AvgUsedCpu = pool.AvgUsedCpu.load(std::memory_order_relaxed),

ydb/library/actors/core/harmonizer/harmonizer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace NActors {
3030
float MaxElapsedCpu = 0.0;
3131
float MinElapsedCpu = 0.0;
3232
float AvgElapsedCpu = 0.0;
33-
i16 PotentialMaxThreadCount = 0;
33+
float PotentialMaxThreadCount = 0.0;
3434
float SharedCpuQuota = 0.0;
3535
bool IsNeedy = false;
3636
bool IsStarved = false;
@@ -57,7 +57,7 @@ namespace NActors {
5757
virtual ~IHarmonizer() {}
5858
virtual void Harmonize(ui64 ts) = 0;
5959
virtual void DeclareEmergency(ui64 ts) = 0;
60-
virtual void AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo = nullptr) = 0;
60+
virtual void AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo = nullptr, bool ignoreFullThreadQuota = false) = 0;
6161
virtual void Enable(bool enable) = 0;
6262
virtual TPoolHarmonizerStats GetPoolStats(i16 poolId) const = 0;
6363
virtual THarmonizerStats GetStats() const = 0;

ydb/library/actors/core/harmonizer/pool.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct TPoolInfo {
3131
i16 MinFullThreadCount = 0;
3232
i16 MaxFullThreadCount = 0;
3333

34+
float ThreadQuota = 0;
3435
float DefaultThreadCount = 0;
3536
float MinThreadCount = 0;
3637
float MaxThreadCount = 0;
@@ -54,13 +55,7 @@ struct TPoolInfo {
5455
std::atomic<ui64> DecreasingThreadsByStarvedState = 0;
5556
std::atomic<ui64> DecreasingThreadsByHoggishState = 0;
5657
std::atomic<ui64> DecreasingThreadsByExchange = 0;
57-
std::atomic<i16> PotentialMaxThreadCount = 0;
58-
std::atomic<ui64> ReceivedHalfThreadByNeedyState = 0;
59-
std::atomic<ui64> GivenHalfThreadByOtherStarvedState = 0;
60-
std::atomic<ui64> GivenHalfThreadByHoggishState = 0;
61-
std::atomic<ui64> GivenHalfThreadByOtherNeedyState = 0;
62-
std::atomic<ui64> ReturnedHalfThreadByStarvedState = 0;
63-
std::atomic<ui64> ReturnedHalfThreadByOtherHoggishState = 0;
58+
std::atomic<float> PotentialMaxThreadCount = 0;
6459

6560
TValueHistory<16> UsedCpu;
6661
TValueHistory<16> ElapsedCpu;

0 commit comments

Comments
 (0)