Do not buffer the Response stream using BufferedHttpEntity#6200
Merged
joviegas merged 20 commits intofeature/master/apache5xfrom Jun 24, 2025
Merged
Do not buffer the Response stream using BufferedHttpEntity#6200joviegas merged 20 commits intofeature/master/apache5xfrom
joviegas merged 20 commits intofeature/master/apache5xfrom
Conversation
… is implementation of HttpClientConnectionManager
…ring content reference to avoid multiple ContentStreamProvider.newStream() calls that cause IOException when retrying requests with non-resettable streams
… Apache 4.x doesnot suports this
…e is value is set to 0 since 0 is treated as Infinite timeToLive in Sdk and Apache 4.x but treated as immediate closeConnection in apache 5.x
…o define Apache5 dependencies in .brazil.json
…cause memory issue, this behaviour is same as Apache4.x
3596705 to
bb70f7d
Compare
|
davidh44
approved these changes
Jun 23, 2025
Comment on lines
+185
to
+188
| @Test | ||
| public void handlesVariousContentLengths() throws Exception { | ||
| SdkHttpClient client = createSdkHttpClient(); | ||
| int[] contentLengths = {0, 1, 100, 1024, 65536}; |
Contributor
There was a problem hiding this comment.
Any reason we don't use parameterized test instead?
Contributor
Author
There was a problem hiding this comment.
This test extends SdkHttpClientTestSuite which is based on Junit 4
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Apache HttpClient 5.x automatically closes response streams after execution, causing premature connection closure when using execute() with response handlers. This differs from Apache 4.x behavior and can lead to connection pool issues. The previous implementation used BufferedHttpEntity to work around this, but it buffers the entire response in memory, causing performance issues for large responses.
Modifications
Testing
Key Inference: Apache4 and Apache5 have virtually identical performance across all benchmarks. The differences are all under 1%, which is within normal variance and not statistically significant. The choice between them should be based on features, maintenance, and compatibility rather than performance.
Will create a separate test for performance benchmarking
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