Skip to content

Conversation

@jterapin
Copy link
Contributor

@jterapin jterapin commented Dec 6, 2025

This PR intends to improve performance for S3's PutObject and UploadPart .


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

  1. To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the CHANGELOG.md file (at corresponding gem). For the description entry, please make sure it lives in one line and starts with Feature or Issue in the correct format.

  2. For generated code changes, please checkout below instructions first:
    https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md

Thank you for your contribution!

@aws aws deleted a comment from github-actions bot Dec 7, 2025
@aws aws deleted a comment from github-actions bot Dec 7, 2025
@github-actions
Copy link

github-actions bot commented Dec 7, 2025

Detected 1 possible performance regressions:

  • aws-sdk-core.gem_size_kb - z-score regression: 405.5 -> 406.5. Z-score: Infinity

@jterapin jterapin marked this pull request as ready for review December 8, 2025 17:36
@jterapin jterapin changed the title [WIP] Support S3 unsigned body Support S3 unsigned body Dec 8, 2025
Copy link
Contributor

@richardwang1124 richardwang1124 left a comment

Choose a reason for hiding this comment

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

Nice! I think it looks good overall to me. Added a few comments.

else
@encoded_buffer << "0\r\n#{trailer_string}\r\n\r\n"
@eof = true
break
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since the while loop has a condition on @eof, you probably don't need the break here

Comment on lines 7 to +8
CHUNK_SIZE = 1 * 1024 * 1024 # one MB
MIN_CHUNK_SIZE = 16_384 # 16 KB
Copy link
Contributor

Choose a reason for hiding this comment

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

I find these constant names a bit confusing - I think we should be more specific about what they are for?
If I'm understanding/remembering correctly, CHUNK_SIZE is the size for checksum/digest computation - so maybe CHECKSUM_CHUNK_SIZE and MIN_CHUNK_SIZE is being used as the default trailer chunk size? so maybe DEFAULT_TRAILER_CHUNK_SIZE


full_chunk_overhead = @base_chunk_size.to_s(HEX_BASE).size + CHUNK_OVERHEAD
chunked_body_size = n_full_chunks * (@base_chunk_size + full_chunk_overhead)
chunked_body_size += partial_bytes.to_s(HEX_BASE).size + partial_bytes + 4 unless partial_bytes.zero?
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, why hard code the 4 here? should it be CHUNK_OVERHEAD?


# Wrapper for request body that implements application-layer
# chunking with Digest computed on chunks + added as a trailer
class AwsChunkedTrailerDigestIO
Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't really sure where to leave this comment - but this class is super complex. I know its indirectly tested through other things, but I think given the complexity we may want to add specs for it by itself to test different cases of length/chunk size

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