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

Speed up async streaming. #313

Merged
merged 5 commits into from
Jun 14, 2023
Merged

Speed up async streaming. #313

merged 5 commits into from
Jun 14, 2023

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Jun 9, 2023

  • Fix bug where async-streaming prevented a meta-request from doing ANY parallelism 😅.
    • We accidentally limited "number of parts in flight" when we meant to limit "number of parts pending read"
  • Reduce gap between sequential reads by running client->update() as soon as the read completes, rather than waiting until after signing is complete.
  • Rename num_parts_sent -> num_parts_started, for clarity
  • Rename (rework) num_parts_read -> num_parts_pending_read.
    • Note this slightly changes the meaning as well, this number goes up and down, and it's never more than 1 for async-streaming.
    • This fixes a bug when resuming an upload. We'd forgot to increment the old num_parts_read along with num_parts_started and num_parts_completed which threw off the math and lead to the upload stalling. It seemed simpler and more obvious to just track the number we care about, rather than have so many different numbers ticking up, from many different locations, and their meaning is weird when skipping is involved.
  • If a stream-reading failure occurs during "resume from pause", reveal the actual error code. Stop covering it with AWS_ERROR_S3_RESUME_FAILED.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Fix bug that prevented any parallelism in async-streams.
- Reduce gap between sequential reads by running client->update() as soon as the read completes, rather than waiting until after signing is complete.
- Rename ~num_parts_sent~ -> `num_parts_started`, for clarity
@codecov-commenter
Copy link

Codecov Report

Merging #313 (f4c3ba0) into main (f5837e5) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
- Coverage   88.99%   88.99%   -0.01%     
==========================================
  Files          17       17              
  Lines        4936     4933       -3     
==========================================
- Hits         4393     4390       -3     
  Misses        543      543              
Impacted Files Coverage Δ
source/s3_auto_ranged_put.c 93.24% <100.00%> (+0.12%) ⬆️

... and 1 file with indirect coverage changes

…resuming a canceled upload.

Bug was: When resuming a paused upload, we increment num_parts_started/completed to account for parts we don't need to re-upload. But we forgot to update `num_parts_read`.

Updating the docs on `num_parts_read` to reflect this new meaning was ... pretty confusing "number of parts started, and read from stream, or that we don't need to read from stream, btw doesn't necessarily reflect the index of where we are due to skipping etc arglbargl"

Decided to just rename the variable to be what we actually care about: ~num_parts_read~ -> `num_parts_pending_read`. Now it goes up and down (not just up) and means what it says and is hopefully less bug-prone.
… the actual error-code. Stop covering it with AWS_ERROR_S3_RESUME_FAILED.
@graebm graebm merged commit 9263f9b into main Jun 14, 2023
@graebm graebm deleted the async-speedup branch June 14, 2023 15:20
jamesbornholt added a commit to jamesbornholt/mountpoint-s3 that referenced this pull request Jun 14, 2023
Picks up awslabs/aws-c-s3#313, which fixes
concurrency in async streaming
jamesbornholt added a commit to jamesbornholt/mountpoint-s3 that referenced this pull request Jun 14, 2023
Picks up awslabs/aws-c-s3#313, which fixes
concurrency in async streaming

Signed-off-by: James Bornholt <bornholt@amazon.com>
jamesbornholt added a commit to awslabs/mountpoint-s3 that referenced this pull request Jun 14, 2023
Picks up awslabs/aws-c-s3#313, which fixes
concurrency in async streaming

Signed-off-by: James Bornholt <bornholt@amazon.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.

3 participants