[grid] & [java] jdk http client - avoid chunking without buffering to memory #11198
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.
Description
Some drivers do not implement transfer-encoding chunked e.g. Chrome
The jdk http client implementation did solve this by buffering the request body into a byte array.
The new implementation will only buffer into memory if the content-length is not know.
@pujagani I think this was the reason the
BodyPublishers.ofInputStream
did not work, whileBodyPublishers.ofByteArray
did work with Edge and Chrome drivers.Motivation and Context
The implementation of
ProtocolHandshake#createSession
does use aFileBackedOutputStream
to keep the memoryconsumption low for big requests. The jdk http client did not handle this and did buffer the complete request to memory.
This change will help not to buffer the new session request.
When the jdk http client is used for the grid, the size of the payload is usually known.
This change will also help not to buffer these request while sending them to the driver.
Types of changes
Checklist