-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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] Add experimental support for StreamingResponse
using RayObjectRefGenerator
#35720
Conversation
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
This reverts commit 122b705. Signed-off-by: SangBin Cho <[email protected]>
This reverts commit 05f468a. Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
Signed-off-by: SangBin Cho <[email protected]>
python/ray/serve/_private/replica.py
Outdated
never_set_event = asyncio.Event() | ||
await never_set_event.wait() | ||
If the result is already a Response type, it will be sent directly. Else it | ||
will be converted to our custom Response type that handles serialization for |
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.
will be converted to our custom Response type that handles serialization for | |
is converted to a custom Response type that handles serialization for |
Signed-off-by: Edward Oakes <[email protected]>
Tip: Use the |
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.
LGTM
Made some minor suggestions.
Signed-off-by: Edward Oakes <[email protected]>
Oh wow that is a revelation 😂 |
…jectRefGenerator` (ray-project#35720) Adds experimental support for using `StreamingResponse`s to stream intermediate results back to the client. This is currently gated behind a feature flag (must set `RAY_SERVE_ENABLE_EXPERIMENTAL_STREAMING=1`. This is implemented by using the Ray `ObjectRefStreamingGenerator` interface. When the feature flag is on, the HTTP proxy will use `num_returns="streaming"` for _all_ calls to downstream replicas. The replica code has been modified to incrementally yield raw ASGI messages back to the HTTP proxy. Known limitations & follow-ups (to be addressed before a non-experimental release): - Minor performance regression due to an extra RPC from streaming protocol (see the microbenchmark results posted on ray-project#35468). Most of this should be able to be optimized away before turning this on by default. - Streaming is not yet possible using the `ServeHandle` interface: ray-project#35777 - `max_concurrent_queries` is not respected by the HTTP proxy when streaming is enabled; we do simple round-robin instead: ray-project#35778 - The timeout set in the HTTP proxy does not apply to streaming responses: ray-project#35779 Signed-off-by: Edward Oakes <[email protected]>
…jectRefGenerator` (#35720) (#35811) Adds experimental support for using `StreamingResponse`s to stream intermediate results back to the client. This is currently gated behind a feature flag (must set `RAY_SERVE_ENABLE_EXPERIMENTAL_STREAMING=1`. This is implemented by using the Ray `ObjectRefStreamingGenerator` interface. When the feature flag is on, the HTTP proxy will use `num_returns="streaming"` for _all_ calls to downstream replicas. The replica code has been modified to incrementally yield raw ASGI messages back to the HTTP proxy. Known limitations & follow-ups (to be addressed before a non-experimental release): - Minor performance regression due to an extra RPC from streaming protocol (see the microbenchmark results posted on #35468). Most of this should be able to be optimized away before turning this on by default. - Streaming is not yet possible using the `ServeHandle` interface: #35777 - `max_concurrent_queries` is not respected by the HTTP proxy when streaming is enabled; we do simple round-robin instead: #35778 - The timeout set in the HTTP proxy does not apply to streaming responses: #35779 Signed-off-by: Edward Oakes <[email protected]>
Extends #35720 to also add support for websockets (as well as detecting HTTP disconnects).
…jectRefGenerator` (ray-project#35720) Adds experimental support for using `StreamingResponse`s to stream intermediate results back to the client. This is currently gated behind a feature flag (must set `RAY_SERVE_ENABLE_EXPERIMENTAL_STREAMING=1`. This is implemented by using the Ray `ObjectRefStreamingGenerator` interface. When the feature flag is on, the HTTP proxy will use `num_returns="streaming"` for _all_ calls to downstream replicas. The replica code has been modified to incrementally yield raw ASGI messages back to the HTTP proxy. Known limitations & follow-ups (to be addressed before a non-experimental release): - Minor performance regression due to an extra RPC from streaming protocol (see the microbenchmark results posted on ray-project#35468). Most of this should be able to be optimized away before turning this on by default. - Streaming is not yet possible using the `ServeHandle` interface: ray-project#35777 - `max_concurrent_queries` is not respected by the HTTP proxy when streaming is enabled; we do simple round-robin instead: ray-project#35778 - The timeout set in the HTTP proxy does not apply to streaming responses: ray-project#35779
…jectRefGenerator` (ray-project#35720) Adds experimental support for using `StreamingResponse`s to stream intermediate results back to the client. This is currently gated behind a feature flag (must set `RAY_SERVE_ENABLE_EXPERIMENTAL_STREAMING=1`. This is implemented by using the Ray `ObjectRefStreamingGenerator` interface. When the feature flag is on, the HTTP proxy will use `num_returns="streaming"` for _all_ calls to downstream replicas. The replica code has been modified to incrementally yield raw ASGI messages back to the HTTP proxy. Known limitations & follow-ups (to be addressed before a non-experimental release): - Minor performance regression due to an extra RPC from streaming protocol (see the microbenchmark results posted on ray-project#35468). Most of this should be able to be optimized away before turning this on by default. - Streaming is not yet possible using the `ServeHandle` interface: ray-project#35777 - `max_concurrent_queries` is not respected by the HTTP proxy when streaming is enabled; we do simple round-robin instead: ray-project#35778 - The timeout set in the HTTP proxy does not apply to streaming responses: ray-project#35779 Signed-off-by: e428265 <[email protected]>
Extends ray-project#35720 to also add support for websockets (as well as detecting HTTP disconnects). Signed-off-by: e428265 <[email protected]>
Why are these changes needed?
Adds experimental support for using
StreamingResponse
s to stream intermediate results back to the client. This is currently gated behind a feature flag (must setRAY_SERVE_ENABLE_EXPERIMENTAL_STREAMING=1
.This is implemented by using the Ray
ObjectRefStreamingGenerator
interface. When the feature flag is on, the HTTP proxy will usenum_returns="streaming"
for all calls to downstream replicas. The replica code has been modified to incrementally yield raw ASGI messages back to the HTTP proxy.Known limitations & follow-ups (to be addressed before a non-experimental release):
ServeHandle
interface: [serve][streaming] Support streaming w/ model composition (usingServeHandle
) #35777max_concurrent_queries
is not respected by the HTTP proxy when streaming is enabled; we do simple round-robin instead: [serve][streaming] Respectmax_concurrent_queries
when using streaming calls #35778Related issue number
#34266
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.