Skip to content

[serve] Add env var overrides when throughput opt is enabled#60757

Merged
abrarsheikh merged 3 commits into
ray-project:masterfrom
akyang-anyscale:alexyang/di-grpc-env-vars
Feb 5, 2026
Merged

[serve] Add env var overrides when throughput opt is enabled#60757
abrarsheikh merged 3 commits into
ray-project:masterfrom
akyang-anyscale:alexyang/di-grpc-env-vars

Conversation

@akyang-anyscale

@akyang-anyscale akyang-anyscale commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing to Ray! 🚀
Please review the Ray Contribution Guide before opening a pull request.

⚠️ Remove these instructions before submitting your PR.

💡 Tip: Mark as draft if you want early feedback, or ready for review when it's complete.

Description

Briefly describe what this PR accomplishes and why it's needed.

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Cursor Bugbot reviewed your changes and found no issues for commit 719363a
Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
@akyang-anyscale akyang-anyscale requested a review from a team as a code owner February 4, 2026 22:25
Signed-off-by: akyang-anyscale <alexyang@anyscale.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR adds an override for RAY_SERVE_ENABLE_DIRECT_INGRESS when throughput optimization is on, enabling it by default in that mode. The change is correct. I've added one comment regarding the pattern of re-defining configuration variables, suggesting a refactor for improved maintainability, though it can be addressed in a follow-up.

"RAY_SERVE_RUN_ROUTER_IN_SEPARATE_LOOP", "0"
)
RAY_SERVE_LOG_TO_STDERR = get_env_bool("RAY_SERVE_LOG_TO_STDERR", "0")
RAY_SERVE_USE_GRPC_BY_DEFAULT = get_env_bool("RAY_SERVE_USE_GRPC_BY_DEFAULT", "1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change follows the existing pattern of overriding constants when RAY_SERVE_THROUGHPUT_OPTIMIZED is enabled. While this is consistent with the surrounding code, this pattern of re-defining variables can be confusing and error-prone, as one has to read the entire file to determine the final value of a constant.

A more robust approach would be to define these constants only once, with their default value determined conditionally based on RAY_SERVE_THROUGHPUT_OPTIMIZED.

For example:

# This would replace the definition at line 574 and this override
_direct_ingress_default = "1" if RAY_SERVE_THROUGHPUT_OPTIMIZED else "0"
RAY_SERVE_ENABLE_DIRECT_INGRESS = get_env_bool(
    "RAY_SERVE_ENABLE_DIRECT_INGRESS", _direct_ingress_default
)

This would require refactoring the other overridden variables for consistency. While this is a larger change that could be done in a follow-up, it would significantly improve the code's clarity and maintainability.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

"RAY_SERVE_RUN_ROUTER_IN_SEPARATE_LOOP", "0"
)
RAY_SERVE_LOG_TO_STDERR = get_env_bool("RAY_SERVE_LOG_TO_STDERR", "0")
RAY_SERVE_USE_GRPC_BY_DEFAULT = get_env_bool("RAY_SERVE_USE_GRPC_BY_DEFAULT", "1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derived variable not updated after throughput optimization reassignment

Medium Severity

When RAY_SERVE_THROUGHPUT_OPTIMIZED is enabled, reassigning RAY_SERVE_USE_GRPC_BY_DEFAULT at line 617 doesn't update RAY_SERVE_PROXY_USE_GRPC, which was already computed earlier at lines 552-555 using the original (False) value. This means enabling throughput optimization won't properly enable gRPC-by-default behavior for the proxy since RAY_SERVE_PROXY_USE_GRPC remains False.

Additional Locations (1)

Fix in Cursor Fix in Web

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
@harshit-anyscale harshit-anyscale added the go add ONLY when ready to merge, run all tests label Feb 5, 2026
@abrarsheikh abrarsheikh merged commit cf6ca75 into ray-project:master Feb 5, 2026
7 checks passed
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…ject#60757)


> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
Signed-off-by: tiennguyentony <46289799+tiennguyentony@users.noreply.github.com>
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…ject#60757)


> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes #1234", "Closes #1234", or "Related to
#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes #1234", "Closes #1234", or "Related to
#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…ject#60757)

> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
Aydin-ab pushed a commit to kunling-anyscale/ray that referenced this pull request Feb 20, 2026
…ject#60757)

> Thank you for contributing to Ray! 🚀
> Please review the [Ray Contribution
Guide](https://docs.ray.io/en/master/ray-contribute/getting-involved.html)
before opening a pull request.

> ⚠️ Remove these instructions before submitting your PR.

> 💡 Tip: Mark as draft if you want early feedback, or ready for review
when it's complete.

## Description
> Briefly describe what this PR accomplishes and why it's needed.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a>
reviewed your changes and found no issues for commit
<u>719363a</u></sup><!-- /BUGBOT_STATUS -->

---------

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

3 participants