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] Decrement ray_serve_deployment_queued_queries when client disconnects #37965

Merged

Conversation

shrekris-anyscale
Copy link
Contributor

Why are these changes needed?

The ray_serve_deployment_queued_queries metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements ray_serve_deployment_queued_queries when a queued request is disconnected.

Related issue number

Closes #37943

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
      • This change adds a unit test to test_telemetry.py.

Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
@edoakes
Copy link
Contributor

edoakes commented Aug 1, 2023

@shrekris-anyscale is this needed in addition to #37939 ?

@shrekris-anyscale
Copy link
Contributor Author

shrekris-anyscale commented Aug 1, 2023

Yes, that PR is tackling a different problem: the queue metric is not getting set when there's no traffic. This change is fixing the issue where queued requests that get disconnected aren't counted properly.

As a sanity check, the unit test in this PR fails locally with just the changes in #37939.

@sihanwang41
Copy link
Contributor

actually, i don't think my pr will fix the issue. we decrease the metrics and set it whenever the request is finished. We can proceed to checkin this pr, and close mine.

@shrekris-anyscale
Copy link
Contributor Author

@edoakes @sihanwang41 this PR is ready for review.


return result
return result
except asyncio.CancelledError:
Copy link
Contributor

Choose a reason for hiding this comment

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

would be an issue if different exceptions happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it would. I changed the code to a try-finally block, so the metric is decremented no matter what exception is raised.

"application": request_meta.app_name,
},
)
query = Query(
Copy link
Contributor

Choose a reason for hiding this comment

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

add try here, so that we don't need to have incremented_queue_metric.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, that makes the code simpler. I made the change.

Signed-off-by: Shreyas Krishnaswamy <shrekris@anyscale.com>
@edoakes edoakes merged commit 1618345 into ray-project:master Aug 2, 2023
43 of 46 checks passed
edoakes pushed a commit to edoakes/ray that referenced this pull request Aug 2, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
rickyyx pushed a commit that referenced this pull request Aug 8, 2023
…isconnects (#37965) (#38020)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Co-authored-by: shrekris-anyscale <92341594+shrekris-anyscale@users.noreply.github.com>
NripeshN pushed a commit to NripeshN/ray that referenced this pull request Aug 15, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: NripeshN <nn2012@hw.ac.uk>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: harborn <gangsheng.wu@intel.com>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
…isconnects (ray-project#37965)

The `ray_serve_deployment_queued_queries` metric tracks the number of queries that have yet to be assigned a replica. If a client disconnects before its query has been assigned a replica– but after the metric has counted their query– the query terminates, but the metric doesn't decrease.

This change decrements `ray_serve_deployment_queued_queries` when a queued request is disconnected.

Signed-off-by: Victor <vctr.y.m@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Serve] ray_serve_deployment_queued_queries doesn't handle client disconnects
3 participants