Repository navigation
Conversation
Reuse the input buffer, append chunk and trailer framing directly, and avoid temporary substrings when draining the encoded buffer. Cover binary payloads, partial reads, EOF, and rewind behavior.
3b850c2 to
32e68dc
Compare
jterapin
left a comment
There was a problem hiding this comment.
Thanks @czj! I’ve rebased this branch onto #3448 and added a separate compatibility commit to preserve custom bodies supporting only read(length). The checksum calculation now hashes the bytes returned by the reader rather than assuming the supplied buffer was filled. As I mentioned in other pr, I hope to remove this check in the next MV.
Could you rerun your benchmarks against the updated branch to confirm that the allocation and performance improvements are retained?
|
Thanks @jterapin for the rebase and the compatibility commit! I reran the benchmark on the updated branch, against
Times are the median of 5 PUTs, ranges over 3 runs. Thanks @ashishdhingra for the review, all three are in 2f3c5a3: These lines come from b708773, which is also on #3448, so #3448 would still have the |
2f3c5a3 to
3a88a09
Compare
|
@ashishdhingra Thanks for the review! The shared fixes are now applied in #3448. @czj I’ve rebased this branch onto the updated #3448. 🤖 This comment was drafted with AI assistance for @jterapin. ✨ |
|
The manual Build SDK dry run passed via validation PR #3489: successful run. This validates the branch rebased onto the updated #3448. 🤖 This comment was drafted with AI assistance for @jterapin. ✨ |
ashishdhingra
left a comment
There was a problem hiding this comment.
Verified fixes and specs locally.
When an endpoint makes
aws-sdk-s3skip trailer checksums (custom endpoints such as Wasabi or Scaleway, plain HTTP, JRuby), the request checksum goes in a header, soupdate_in_chunksreads the whole body first. Eachio.read(CHECKSUM_CHUNK_SIZE)returns a new 1 MiB String, so a 72 MB upload allocates 72 MiB of temporary Strings before a single byte is sent.This reads every chunk into the same buffer with
io.read(CHECKSUM_CHUNK_SIZE, chunk). Passing a buffer is safe for any body the SDK already accepts: Net::HTTP sends bodies throughIO.copy_stream, which callsread(length, buffer)on non-IO objects, andParamListand the trailerChecksumIOalready take one.put_objectagainst a stubbed endpoint, 5 PUTs per size:The new spec checks the CRC32 of a multi-chunk body and that every read got the same buffer. It fails without the change.
checksum_algorithm_specpasses (52 examples). I didn't run the HTTP/2 specs, my local bundle doesn't havehttp-2. #3448 is about the trailer path, not this one.Generated by AI tools (Claude Code). Prompted, read, and verified by @czj, a caring human :)