Skip to content

fix(plan): hold a starved pool instead of growing it - #15

Merged
sylvesterdamgaard merged 1 commit into
mainfrom
fix/starved-growth-suppression
Sep 9, 2026
Merged

sylvesterdamgaard merged 1 commit into
mainfrom
fix/starved-growth-suppression

Conversation

@sylvesterdamgaard

Copy link
Copy Markdown
Contributor

Part 2 of #14. noteStarved has always diagnosed the case correctly — "the queue is the CPU's, not the ceiling's" — while the plan grew the pool on the same round's ceiling-hit signal. Measured on a 2-CPU container under saturated CPU-bound load (php-baseimages benchmark): growth 8 → 21 workers, −16% throughput (worker sweep monotonic downward on pure CPU: 2w=403 … 21w=310 rps).

Change: plan.Input gains HostBusy/HostBusyKnown (wired from serve's existing hostBusyRatio). While a pool queues and the host is ≥95% busy, its ceiling-hit is ignored and its CPU ceiling is pinned to its current size so headroom demand cannot grow it either. Result.StarvedHeld reports held pools. Unknown busy ratio ⇒ old behavior exactly; growth resumes when the CPU has room.

Not addressed: cpu_readings=0 for sub-50ms requests (minCPURequestMicros) — needs its own design discussion, stays open on #14.

Tests: TestBuild_StarvedPoolIsHeldNotGrown (held / resume / unknown); full suite, vet, gofmt, sbom-check, license-check green.

noteStarved has always diagnosed the case correctly - 'the queue is the
CPU's, not the ceiling's' when a pool queues while the host CPU is >=95%
busy - but the plan still treated the ceiling-hit as demand and grew the
pool. On a 2-CPU container under saturated CPU-bound load that meant
8 -> 21 workers and -16% throughput (php-baseimages benchmark; the
worker sweep is monotonic downward on pure CPU).

plan.Input gains HostBusy/HostBusyKnown (wired from serve's existing
hostBusyRatio). While starved, a pool's ceiling-hit is ignored AND its
CPU ceiling is pinned to its current size so headroom-driven demand
cannot grow it either; Result.StarvedHeld reports the held pools.
Unknown busy ratio preserves the old behavior exactly.

The issue's other symptom (cpu_readings staying 0) is the 50ms
minCPURequestMicros floor and stays open on #14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant