You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if the the builder of an AsyncHttpClient.Request object has a Netty ByteBuf, they must first convert it to a ByteBuffer/byte[]/ByteArrayInputStream/etc to pass it in, which generally means at least one allocation and two memory copies (into the temp buffer and then back out). This is very inefficient in both memory and CPU. I propose a new NettyByteBufBody that extends NettyDirectBody and will submit a PR to that effect. Another possible approach would be to add a Request.getNettyBody() method that allowed callers to plug in anything that implemented the NettyBody interface, but that feels like a slightly more dangerous change.
The text was updated successfully, but these errors were encountered:
dgolombek
pushed a commit
to dgolombek/async-http-client
that referenced
this issue
Apr 3, 2024
This extends RequestBuilderBase+Request+NettyRequestFactory to allow
providing a Netty ByteBuf as input in an efficient manner, avoiding
having to convert that ByteBuf to a ByteBuffer and then back.
FixesAsyncHttpClient#1951
@hyperxpro anything I can do to help get this reviewed and merged? I have some work time to help with this project, starting with a few things we need, but then can also help with backlog of bugs or whatever else makes sense. Thanks.
* Extend Request to support ByteBuf inputs
This extends RequestBuilderBase+Request+NettyRequestFactory to allow
providing a Netty ByteBuf as input in an efficient manner, avoiding
having to convert that ByteBuf to a ByteBuffer and then back.
Fixes#1951
* Fix up test for repeatability
---------
Co-authored-by: David Golombek <[email protected]>
Co-authored-by: Aayush Atharva <[email protected]>
Currently if the the builder of an AsyncHttpClient.Request object has a Netty ByteBuf, they must first convert it to a ByteBuffer/byte[]/ByteArrayInputStream/etc to pass it in, which generally means at least one allocation and two memory copies (into the temp buffer and then back out). This is very inefficient in both memory and CPU. I propose a new NettyByteBufBody that extends NettyDirectBody and will submit a PR to that effect. Another possible approach would be to add a Request.getNettyBody() method that allowed callers to plug in anything that implemented the NettyBody interface, but that feels like a slightly more dangerous change.
The text was updated successfully, but these errors were encountered: