-
Notifications
You must be signed in to change notification settings - Fork 931
Do not buffer the Response stream using BufferedHttpEntity #6200
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
Do not buffer the Response stream using BufferedHttpEntity #6200
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
|
@Test | ||
public void handlesVariousContentLengths() throws Exception { | ||
SdkHttpClient client = createSdkHttpClient(); | ||
int[] contentLengths = {0, 1, 100, 1024, 65536}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we don't use parameterized test instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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 install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License