feat: per-queue resource awareness with measured CPU/memory estimates#18
Merged
Conversation
Add AutoscaleConfiguration::queueResources() static method to read per-queue CPU/memory resource overrides from config, with tests and updated config docs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…oves internal estimate state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…city calculation Injects ResourceEstimateResolver into ScalingEngine and calls resolve() with the queue's connection/queue name in evaluate(), passing the resulting ResourceEstimate to CapacityCalculator::calculateMaxWorkers(). Updates all test consumers (unit, feature, simulation) to supply the new resolver argument. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lt() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nto resolver Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…solver Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #14 — Phase 1 + Phase 2 foundation for per-queue resource-aware capacity calculations.
ResourceEstimatevalue object — carries per-worker CPU cores and memory MB estimates with per-dimension source metadata (Measured,Config,Default) and sample countsResourceEstimateResolversingleton — three-source precedence chain: measured runtime data > per-queue config override > global default. Each dimension (CPU, memory) resolves independentlyCapacityCalculatorrefactored —calculateMaxWorkers()now requires aResourceEstimateparameter instead of reading from internal state; memory calculations are now adaptive (were previously static config only)AutoscaleManagerwrites per-queue measured estimates — replaces the oldupdateMeasuredWorkerCpuEstimate()(global weighted average across all jobs) withupdateMeasuredResourceEstimates()that groups byconnection:queueand tracks both CPU and memoryresourcesconfig — operators can declarecpu_coresandmemory_mbper queue as cold-start fallbacks before measured data is availableWhat this enables
For heterogeneous workloads (e.g. fast 50MB jobs vs slow 2GB jobs on different queues), the autoscaler now uses the actual resource shape of each queue for capacity math instead of flattening everything to a single global average. This prevents over-provisioning fast queues and under-provisioning heavy queues.
Architecture
Resolution order per dimension:
measured→queue.resources config→limits.worker_*_estimateNot included (future phases)
distributeClusterTarget()— the resolver and per-queue estimates are in place, distribution just needs to consume themsampleCount < 50)Test plan
property.unusedTypewarning, not introduced by this PR)ResourceEstimate,ResourceEstimateResolver(11 tests covering all precedence paths, clamping, partial measurement, queue isolation, reset)CapacityCalculator,ScalingEngine, policy, cluster, and simulation tests updated and passing