[S3] Fixing PutObject High Memory Usage#899
Merged
spati2 merged 1 commit intoaws:masterfrom Mar 29, 2018
Merged
Conversation
See aws#894 for detailed description
Contributor
Author
|
@sstevenkang Is there anything I can do here to get this PR merged? Thanks, |
Contributor
|
Interesting. Let me check with the team regarding the history of choosing 128*1024 as the default size. |
Contributor
Author
|
Hi @sstevenkang, Any news? Thanks, |
Member
|
Thanks for the pull request. This went out with version 3.3.21.19 of AWSSDK.Core |
Contributor
Author
|
Thanks for accepting this, really appreciate it. FYI |
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.
See #894 for detailed description
Description
Previously, when invoking the constructor of
ChunkedUploadWrapperStreamit used to create two byte arrays each with a size of131,072(128*1024). From a memory aspect this is inefficient as objects over85,000bytes go straight into an area of memory known as the Large Object Heap (LOH). This area is never compacted by default (as compaction of the LOH is expensive), but is collected. Over a lifetime of an application it is possible to end up in a situation where the LOH has taken up most of the RAM.Now, the byte arrays are still created but with a size of
81,920. The reason for this number can be found here: https://referencesource.microsoft.com/#mscorlib/system/io/stream.cs,50. As81,920is under the85,000threshold the byte arrays in question go onto the Small Object Heap (SOH). This area of memory is collected and compacted by default.Motivation and Context
To reduce memory consumption of this call:-
aws-sdk-net/sdk/src/Services/S3/Generated/_bcl45/AmazonS3Client.cs
Line 4421 in 9814e24
Testing
See #894 for benchmarks within a test harness for pre/post change.
Screenshots (if appropriate)
See #894 for screenshots
Types of changes
Checklist
License