Skip to content

Enable zero-copy ByteBuffer publishing in AsyncRequestBody "unsafe" constructors #4096

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

Conversation

StephenFlavin
Copy link
Contributor

@StephenFlavin StephenFlavin commented Jun 12, 2023

Removes guards put in place on #3925 to ensure off-heap buffers were copied to on-heap.
This change to the code enables off-heap buffers to be published directly allowing improved performance zero-copy transfers.

Motivation and Context

see: #3928
This change is effectively running in my own production code where I upload files via MappedByteBuffer, when performance testing I was able to achieve a 25% performance improvement over TransferManager uploading a 1GB file.

Modifications

Removes a condition in ByteBuffersAsyncRequestBody that converts a direct (off-heap) buffer to a non-direct (on-heap) buffer.

Testing

The functionality is covered by existing tests, I've only removed a test which I put in place as a pre-cursor to this change

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@millems
Copy link
Contributor

millems commented Jun 27, 2023

Sorry about the delay on reviewing this. Looks great! Kicking off the tests...

@StephenFlavin
Copy link
Contributor Author

StephenFlavin commented Jun 28, 2023

No worries @millems, wish I could see that test output 😅

@StephenFlavin
Copy link
Contributor Author

hey @millems,
with the revert closed could you tell me what the build failure is?

@millems
Copy link
Contributor

millems commented Jul 6, 2023

@StephenFlavin

It's something silly:

[ERROR] /codebuild/output/src391546243/src/github.com/aws/aws-sdk-java-v2/core/sdk-core/src/main/java/software
/amazon/awssdk/core/internal/async/ByteBuffersAsyncRequestBody.java:28:8: Unused import - 
software.amazon.awssdk.utils.BinaryUtils. [UnusedImports]

@StephenFlavin StephenFlavin force-pushed the enable-zero-copy-bytebuffers-in-asyncrequestbody-unsafe-methods branch from baa0b8c to 0ba3e4f Compare July 7, 2023 11:10
@StephenFlavin
Copy link
Contributor Author

🤦 fixed

@millems
Copy link
Contributor

millems commented Jul 7, 2023

Rerunning tests

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@millems millems merged commit 55383d3 into aws:master Jul 10, 2023
@millems
Copy link
Contributor

millems commented Jul 10, 2023

Thanks for your contribution! Sorry about the long time getting it merged.

L-Applin pushed a commit that referenced this pull request Jul 24, 2023
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