AsyncHttpClient/async-http-client

Requests should take ByteBuf as input data in efficient manner

dgolombek opened this issue · 1 comments

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.

@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.