Repository navigation
Conversation
…er handlers Dataflow's GPU autoscaling reads num_loaded_models_<tag> in the BeamML_ModelManager namespace as the number of messages each worker can hold. A model handler that serves inference through an out-of-process server (vLLM, Triton, ...) always has exactly one loaded copy per worker, so it needs to publish a capacity estimate under that metric instead. Add a generic library for that in apache_beam.ml.inference.autoscaling_metrics: - NumLoadedModelsPublisher publishes a capacity signal on a background thread, resetting the process-wide distribution so the latest value (not a lifetime mean) is reported, with optional aggregation policies on top. - PrometheusCounterGaugeSampler reads a server's completed-requests counter and in-flight gauge from its Prometheus /metrics endpoint; the metric names are the only server-specific input. - CompletionRateCapacityEstimator turns those samples into a per-worker capacity estimate: per-slot throughput times p90 concurrency over a trailing window. It does no I/O. - AutoscalingMetricConfig holds the user-facing knobs, resolves the metric tag (explicit tag, then the RunInference model identifier verbatim, then a sanitized model name), and builds the estimator and publisher.
3 tasks done
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40907 +/- ##
==========================================
+ Coverage 79.83% 79.85% +0.01%
==========================================
Files 494 495 +1
Lines 83575 83837 +262
==========================================
+ Hits 66722 66944 +222
- Misses 16853 16893 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Split out of #40760, following review feedback to separate the generic pieces from the vLLM-specific ones and to split autoscaling into collection/publishing vs. vLLM consumption. This PR is the generic library; the vLLM handler uses it in a follow-up, and a Triton handler is planned to reuse it.
Why
Dataflow's GPU autoscaling reads
num_loaded_models_<tag>in theBeamML_ModelManagernamespace as the number of messages each worker can hold, and sizes the pool roughly asceil(backlog / reported). A handler that serves inference through an out-of-process model server always has exactly one loaded copy per worker, so it needs to publish an estimate of the worker's capacity under that metric instead.What (
apache_beam.ml.inference.autoscaling_metrics, new)Nothing in this module depends on a particular model server.
NumLoadedModelsPublisher(publishing): polls a capacity signal on a background thread and publishes it undernum_loaded_models_<tag>.lastby default; alsolifetime_max,max,pNN,mean).PrometheusCounterGaugeSampler(collection): reads a server's completed-requests counter and in-flight gauge from its Prometheus/metricsendpoint. The two metric names are the only server-specific input.CompletionRateCapacityEstimator(collection): turns those samples intocapacity = per-slot throughput × p90 concurrency × multiplierover a trailing window, with warmup and idle-tick handling.(completed_total, running)samples.AutoscalingMetricConfig: user-facing knobs, metric-tag resolution (resolve_tag: an explicit tag, then the RunInference model identifier verbatim, then a sanitized model name), and factories for the estimator and publisher.Pairs with the
ModelHandler.set_model_identifier()hook (separate PR), which supplies the RunInference model identifier forresolve_tag. No dependency between the two PRs.Testing
autoscaling_metrics_test.py:The estimator gives identical results to the version validated in #40760's staging runs (checked on 2,000 randomized traces).
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123orfixes #456).CHANGES.mdwith noteworthy changes.