Repository navigation
Conversation
This branch has not been deployed
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.
Motivation and Context
getObject(request, AsyncResponseTransformer.toBlockingInputStream())on the CRT-based S3 client copies every downloaded part from native memory into a new heapbyte[]. For large, slow, concurrent downloads that results in sustained heap allocation and GC pressure.aws-crt-javais adding a new feature that adds a direct buffer pool that can lend part buffers to a response handler instead of copying them.This PR targets
feature/master/dbz-poolbranch. It depends on a futureaws-crt-javarelease that contains the direct buffer pool feature, so CI checks are expected to fail until a released version is available and the SDK dependency is bumped.Transfer Manager support follows in a separate PR.
Modifications
S3CrtDirectBufferPoolConfigurationwithauto(),fixed(long)andelastic(long, long), andS3CrtAsyncClientBuilder.directBufferPoolConfiguration(...)to attach a pool to the CRT client.S3CrtAsyncResponseTransformer.toBlockingInputStreamFromDirectBufferPool(). On a CRT client with a pool, it returns aResponseInputStreamthat reads CRT's direct buffers and releases each one, and credits the read window, once it has been read.read(byte[])still copies into the caller's array.GetObjectrequests withpartNumberuse separately allocated native memory instead of the pool.getObjectcall. The request fails before it is sent on a client without a pool, on the Java-based S3 client, when the transformer is wrapped, or when a transformer is reused.Behavior changes
directBufferPoolConfiguration.minimumPartSizeInBytesis used as set, so a multipart upload fails before sending data if it is below 5 MiB or the object needs more than 10,000 parts. Without a configured part size, a fixed pool limits a known-size multipart upload to 312.5 GiB, or less for a pool smaller than 32 MiB.minimumPartSizeInBytesexceeds the pool's part-size limit, or if afixed()orelastic()ceiling does not fit within 80% of-XX:MaxDirectMemorySize.toBlockingInputStreamFromDirectBufferPool()don't applymodifyAsyncHttpResponseContentto the object body.Testing
partNumber, transformer reuse and pool configuration.Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License