diff options
author | kruall <kruall@ydb.tech> | 2023-03-29 12:58:19 +0300 |
---|---|---|
committer | kruall <kruall@ydb.tech> | 2023-03-29 12:58:19 +0300 |
commit | 685b449901ac5a7fa50364aa04e5829c68488355 (patch) | |
tree | 284c3316183a3ba39898f473dc7db35ee170f3ee /library | |
parent | 98d8d4770f77f33188bb1f38be51e6ac398ef1fd (diff) | |
download | ydb-685b449901ac5a7fa50364aa04e5829c68488355.tar.gz |
Fix is starved with no working threads,
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/actors/core/harmonizer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/cpp/actors/core/harmonizer.cpp b/library/cpp/actors/core/harmonizer.cpp index 92a2b533b6..a1838ee2b0 100644 --- a/library/cpp/actors/core/harmonizer.cpp +++ b/library/cpp/actors/core/harmonizer.cpp @@ -331,7 +331,7 @@ void THarmonizer::PullStats(ui64 ts) { } Y_FORCE_INLINE bool IsStarved(double consumed, double booked) { - return consumed < booked * 0.7; + return Max(consumed, booked) > 0.1 && consumed < booked * 0.7; } Y_FORCE_INLINE bool IsHoggish(double booked, ui16 currentThreadCount) { @@ -397,6 +397,9 @@ void THarmonizer::HarmonizeImpl(ui64 ts) { AtomicSet(pool.PotentialMaxThreadCount, Min(pool.MaxThreadCount, budgetInt)); } double overbooked = consumed - booked; + if (overbooked < 0) { + isStarvedPresent = false; + } if (isStarvedPresent) { // last_starved_at_consumed_value = сумма по всем пулам consumed; // TODO(cthulhu): использовать как лимит планвно устремлять этот лимит к total, @@ -412,7 +415,7 @@ void THarmonizer::HarmonizeImpl(ui64 ts) { TPoolInfo &pool = Pools[poolIdx]; i64 threadCount = pool.GetThreadCount(); while (threadCount > pool.DefaultThreadCount) { - pool.SetThreadCount(threadCount - 1); + pool.SetThreadCount(--threadCount); AtomicIncrement(pool.DecreasingThreadsByStarvedState); overbooked--; LWPROBE(HarmonizeOperation, poolIdx, pool.Pool->GetName(), "decrease", threadCount - 1, pool.DefaultThreadCount, pool.MaxThreadCount); |