-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[serve] Transform replica level metrics to AutoScalingContext constructor args #57202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zcin
merged 18 commits into
ray-project:master
from
arcyleung:autoscaling-context-metrics
Oct 16, 2025
Merged
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3fbea82
enrich autoscaling context
abrarsheikh 6823c84
reuse
abrarsheikh 793bc8a
add back requests
abrarsheikh 3671aef
dedicated key for queued
abrarsheikh a35a176
update docs
abrarsheikh e86f3e9
update docs
abrarsheikh 8656f95
fix test
abrarsheikh 9050929
Add doc example as test case
69fbce2
Merge branch 'autoscaling-context-metrics' of https://github.com/arcy…
7f05034
Increase interval of RAY_SERVE_REPLICA_AUTOSCALING_METRIC_RECORD_INTE…
377ca28
Merge branch 'master' into autoscaling-context-metrics
arcyleung dbd575f
Fix lint
cca67f2
refactor code for simplicity
abrarsheikh ceab7f7
remove redundant function
abrarsheikh 556d2e9
fix docs
abrarsheikh 9594687
Add missing look_back_period_s to TestCustomServeMetrics autoscaling …
53b490f
Return types
fa95474
Merge remote-tracking branch 'origin/master' into autoscaling-context…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,12 +31,27 @@ py_test_module_list( | |
| ) | ||
|
|
||
| # Custom metrics tests. | ||
| py_test_module_list( | ||
| py_test_module_list_with_env_variants( | ||
| size = "small", | ||
| env = { | ||
| "RAY_SERVE_COLLECT_AUTOSCALING_METRICS_ON_HANDLE": "0", | ||
| "RAY_SERVE_REPLICA_AUTOSCALING_METRIC_RECORD_INTERVAL_S": "2", | ||
| "RAY_SERVE_RECORD_AUTOSCALING_STATS_TIMEOUT_S": "3", | ||
| env_variants = { | ||
| "metr_agg_at_controller": { | ||
| "env": { | ||
| "RAY_SERVE_AGGREGATE_METRICS_AT_CONTROLLER": "1", | ||
| "RAY_SERVE_COLLECT_AUTOSCALING_METRICS_ON_HANDLE": "0", | ||
| "RAY_SERVE_REPLICA_AUTOSCALING_METRIC_RECORD_INTERVAL_S": "0.1", | ||
|
||
| "RAY_SERVE_RECORD_AUTOSCALING_STATS_TIMEOUT_S": "3", | ||
| }, | ||
| "name_suffix": "_metr_agg_at_controller", | ||
| }, | ||
| "metr_agg_at_replicas": { | ||
| "env": { | ||
| "RAY_SERVE_AGGREGATE_METRICS_AT_CONTROLLER": "0", | ||
| "RAY_SERVE_COLLECT_AUTOSCALING_METRICS_ON_HANDLE": "0", | ||
| "RAY_SERVE_REPLICA_AUTOSCALING_METRIC_RECORD_INTERVAL_S": "0.1", | ||
| "RAY_SERVE_RECORD_AUTOSCALING_STATS_TIMEOUT_S": "3", | ||
| }, | ||
| "name_suffix": "_metr_agg_at_replicas", | ||
| }, | ||
| }, | ||
| files = [ | ||
| "test_custom_autoscaling_metrics.py", | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Autoscaling Policy Uses Incorrect Metrics
The autoscaling policy example now calculates CPU and memory usage based on a single replica's metrics instead of the maximum across all replicas. This change can lead to incorrect autoscaling decisions by not considering the highest resource utilization.