-
Notifications
You must be signed in to change notification settings - Fork 175
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
Improve get_object interface for backpressure #1200
Conversation
Currently, we support flow-control window for GetObject requests by allowing applications to call `GetObjectResponse::increment_read_window` but it is tricky to use because we need to hold onto the stream itself in order to control the feedback loop while also consuming the data. This change introduces a new trait `ClientBackpressureHandle` for controlling the read window so that the stream and the flow-control paths are decoupled. Applications can now call `GetObjectResponse::take_backpressure_handle` to get a backpressure handle from the response and use this handle to extend the read window. Signed-off-by: Monthon Klongklaew <[email protected]>
Signed-off-by: Monthon Klongklaew <[email protected]>
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.
I have a couple of suggestions, but I like the improvement.
Signed-off-by: Monthon Klongklaew <[email protected]>
bd7c42e
to
f472f60
Compare
mountpoint-s3-client/CHANGELOG.md
Outdated
@@ -8,6 +8,9 @@ | |||
* `get_object` method now requires a `GetObjectParams` parameter. | |||
Two of the existing parameters, `range` and `if_match` have been moved to `GetObjectParams`. | |||
([#1121](https://github.com/awslabs/mountpoint-s3/pull/1121)) | |||
* `increment_read_window` and `read_window_end_offset` methods have been removed from `GetObjectResponse`. | |||
`ClientBackpressureHandle` can be used to interact with flow-control window instead, it can be retrieved from `take_backpressure_handle` method. |
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.
Update method name.
headers: Headers, | ||
/// Next offset of the data to be polled from [poll_next] | ||
next_offset: u64, | ||
/// Upper bound of the current read window. When backpressure is enabled, [S3GetObjectRequest] | ||
/// can return data up to this offset *exclusively*. | ||
read_window_end_offset: u64, | ||
read_window_end_offset: Arc<AtomicU64>, |
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.
Do we need to keep a copy here? Couldn't we just use the one in backpressure_handle
? I also suspect enable_backpressure
may be redundant. Isn't it just backpressure_handle.is_some()
?
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.
Yes, you're right. Updated for both CRT client and the mock client.
Signed-off-by: Monthon Klongklaew <[email protected]>
Currently, we support flow-control window for GetObject requests by allowing applications to call
GetObjectResponse::increment_read_window
but it is tricky to use because we need to hold onto the stream itself in order to control the feedback loop while also consuming the data.This change introduces a new trait
ClientBackpressureHandle
for controlling the read window so that the stream and the flow-control paths are decoupled.Applications can now call
GetObjectResponse::take_backpressure_handle
to get a backpressure handle from the response and use this handle to extend the read window.Does this change impact existing behavior?
Yes, there is a breaking change for
mountpoint-s3-client
.Does this change need a changelog entry?
Yes, for
mountpoint-s3-client
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).