Skip to content
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

[serve] eagerly create router for handles held by proxy #47031

Merged
merged 14 commits into from
Aug 13, 2024

Conversation

zcin
Copy link
Contributor

@zcin zcin commented Aug 8, 2024

Why are these changes needed?

Eagerly create the router for handles held by the proxy actor, so that the controller can send the replica sets + their actor handles for each deployment upon proxy startup, instead of waiting for the first request to come in. This helps with improving controller fault tolerance.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Copy link
Contributor

@GeneDer GeneDer left a comment

Choose a reason for hiding this comment

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

Would be nice to add a new test maybe try to update routes on start and see the differences with/ without this change. But code itself LGTM

Comment on lines 73 to 75
# Eagerly instantiate the router for each handle so it can receive
# the replica set from the controller.
handle._get_or_create_router()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would prefer that we add an argument to get_handle instead of adding a private method call here

Copy link
Contributor Author

@zcin zcin Aug 9, 2024

Choose a reason for hiding this comment

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

sounds good, added _lazily_initialize_router to get_deployment_handle and DeploymentHandle constructor. This is set to false in the proxy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edoakes Removed the parameter for now because it causes the router to be initialized before options passed in .options() are picked up by the initialized router, and there is no super clean way of adding the param and fixing that. Reverted to manually calling private method, will think more about how to add an official parameter for this.

@zcin
Copy link
Contributor Author

zcin commented Aug 9, 2024

Would be nice to add a new test maybe try to update routes on start and see the differences with/ without this change. But code itself LGTM

I've added tests for the new parameter I added for get handle. As for testing this in the proxy, I'll be adding more comprehensive e2e tests once more changes are made in later PRs!

@zcin zcin added the go add ONLY when ready to merge, run all tests label Aug 9, 2024
Signed-off-by: Cindy Zhang <[email protected]>
@zcin zcin force-pushed the proxy-eagerly-create-router branch from 6e6ffe7 to 2dd489c Compare August 12, 2024 18:40
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
@zcin zcin force-pushed the proxy-eagerly-create-router branch from c54373b to b094495 Compare August 12, 2024 22:29
@zcin zcin merged commit b4897b8 into ray-project:master Aug 13, 2024
5 checks passed
@zcin zcin deleted the proxy-eagerly-create-router branch August 21, 2024 15:13
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants