mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-25 18:40:18 -04:00
Reset hill-climb direction after idle period
When throughput dropped below 0.5 (idle), decline_streak was reset but direction was preserved. When work resumed, the monitor continued in whatever direction it held before the idle period — often a shrink direction that was correct for the previous workload but wrong for the new burst. This could cause the pool to shrink immediately when it should be growing. Reset direction to +1 (grow) when entering the idle branch so the pool starts the next active period biased toward growth, which is the safer default under new load. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b150f2c685
commit
2333f6078a
1 changed files with 5 additions and 1 deletions
|
|
@ -527,10 +527,14 @@ ThreadPool::monitor_routine(void *arg_)
|
|||
double prev_ema = ema_throughput;
|
||||
ema_throughput = ema_alpha * (double)raw_throughput + (1.0 - ema_alpha) * ema_throughput;
|
||||
|
||||
// Only adjust if there's meaningful work happening
|
||||
// Only adjust if there's meaningful work happening.
|
||||
// Reset direction to +1 (bias toward growth) so a stale
|
||||
// shrink direction from before the idle period doesn't
|
||||
// penalize the pool when work resumes.
|
||||
if(ema_throughput < 0.5 && prev_ema < 0.5)
|
||||
{
|
||||
decline_streak = 0;
|
||||
direction = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue