Repository navigation
S3: avoid full-source reads for UploadPartCopy ranges - #10565
Open
tonypottera24 wants to merge 2 commits into
Open
tonypottera24 wants to merge 2 commits into
tonypottera24 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UploadPartCopyreads the complete source object before slicingx-amz-copy-source-range. Copying many small parts from a large source therefore repeatedly materializes the full source.Reuse
FakeKey.get_value(start, end)from #10564 to read only the requested source bytes under the existing per-key lock. Source-version resolution and multipart part creation stay with their existing owners. A copy without a source range reads the complete source.Depends on #10564. This branch contains its GET commit followed by the Copy commit. The Copy-specific change is 24acb5d6e; compare only this follow-up. It needs rebasing after the parent lands.
The HTTP regression test covers memory-backed and disk-backed sources, both unversioned and with a selected non-current version. It checks that copying 16 bytes reads only 16 bytes, completes the multipart upload and verifies the resulting object. All four variants fail on the parent with
read(8192)instead ofread(16).Validation on Python 3.14.4, boto3/botocore 1.44.3:
mypy moto/s3passed.A local decorator-mode comparison uses one disk-backed 128 MiB source and 32 source-range copies of 1 MiB each. Source upload/initiation and the subsequent byte verification/abort are outside the timed loop. Each sample verifies every copied part and aborts its multipart upload.
fd4fa84f30476da7916ca0bdee357b99dd78140124acb5d6eParent wall-time samples: 2.035425, 2.107370, 2.094906 s. Changed samples: 0.086524, 0.091552, 0.084613 s. Both perform 32 source reads; source read amplification drops from 128x to 1x. These are local SDK/mock measurements, not AWS or network throughput.
Reproduce the measurement
Run this script in the same environment on the parent and Copy commits: