Skip to content
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

Refactor S3 Transfer Manager uploadDirectory to limit the number of c… #5031

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Mar 21, 2024

…oncurrent upload file requests.

Motivation and Context

Currently, there's no limit on the number of uploadFileRequets in parallel; it depends on how fast it traverses the file and all futures are kept in memory. This could cause memory issues for users who upload a directory that has millions of files because millions of futures will be in memory until upload directory finishes.
See #5023

Modifications

  • Set a limit on the number of concurrent upload file requests for upload directory by using AsyncBufferingSubscriber that controls the request concurrency (it's used in downloadDirectory as well).

  • Only keep the request futures that are in flight by not storing all futures in a list and not keeping reference through CompletableFutureUtils.forwardExceptionTo

Testing

Existing tests passed.
Tested on EC2 instance to upload a large directory and verified memory usage.

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

@zoewangg zoewangg requested a review from a team as a code owner March 21, 2024 17:18
@zoewangg zoewangg force-pushed the zoewang/uploadDirectoryRefactor branch from 77b88f5 to 43d127f Compare March 22, 2024 22:20
@zoewangg zoewangg enabled auto-merge (squash) March 26, 2024 20:37
Copy link

sonarcloud bot commented Mar 26, 2024

@zoewangg zoewangg merged commit 9be4570 into master Mar 26, 2024
17 checks passed
@zoewangg zoewangg deleted the zoewang/uploadDirectoryRefactor branch March 26, 2024 21:42
akidambisrinivasan pushed a commit to akidambisrinivasan/aws-sdk-java-v2 that referenced this pull request Jun 28, 2024
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.

2 participants