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

Improve get_object interface for backpressure #1200

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

monthonk
Copy link
Contributor

@monthonk monthonk commented Dec 12, 2024

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).

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]>
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 10:55 — with GitHub Actions Inactive
@monthonk monthonk marked this pull request as ready for review December 12, 2024 11:17
Signed-off-by: Monthon Klongklaew <[email protected]>
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 12, 2024 11:24 — with GitHub Actions Inactive
@monthonk monthonk requested a review from passaro December 12, 2024 11:42
Copy link
Contributor

@passaro passaro left a 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.

mountpoint-s3-client/src/object_client.rs Outdated Show resolved Hide resolved
mountpoint-s3-client/src/object_client.rs Outdated Show resolved Hide resolved
mountpoint-s3/src/prefetch/part_stream.rs Outdated Show resolved Hide resolved
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 13, 2024 14:52 — with GitHub Actions Inactive
Signed-off-by: Monthon Klongklaew <[email protected]>
@monthonk monthonk force-pushed the improve_backpressure_get branch from bd7c42e to f472f60 Compare December 16, 2024 16:29
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 16, 2024 16:29 — with GitHub Actions Inactive
@monthonk monthonk requested a review from passaro December 16, 2024 16:45
@@ -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.
Copy link
Contributor

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>,
Copy link
Contributor

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()?

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, you're right. Updated for both CRT client and the mock client.

Signed-off-by: Monthon Klongklaew <[email protected]>
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk temporarily deployed to PR integration tests December 17, 2024 11:01 — with GitHub Actions Inactive
@monthonk monthonk requested a review from passaro December 17, 2024 11:22
@monthonk monthonk added this pull request to the merge queue Dec 17, 2024
Merged via the queue into awslabs:main with commit d5b36e8 Dec 17, 2024
23 checks passed
@monthonk monthonk deleted the improve_backpressure_get branch December 17, 2024 14:20
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.

2 participants