2016-08-31 19:55 GMT+02:00 Violeta Georgieva <miles...@gmail.com>:

> Do you mean the APR case or also NIO and NIO2? With the new API
> CoyoteOutputStream.write(ByteBuffer) the application layer may provide
> direct ByteBuffers so why should we copy them to the socket write buffer
> and not use them directly?
>
> I'm talking about NIO+OpenSSL where it's done in our code, for example,
but internally the JDK does it too.
Even if the application can suddenly use direct buffers, that's not a good
idea since GC isn't working and it's more costly (see ByteBufferUtils.
cleanDirectBuffer). IMO the best model remains using a (direct) buffer
where all writes go through in that case. I think it is disappointing too
since it takes away a lot of my improvement ideas (NIO2 scatter/gather, for
starters).

So I think your API change is probably good, but at the end it's going to
be better to write to / read from the socket buffer in many cases rather
than directly on the socket. It could be a good idea to always do it for
consistency.

More experimentation is needed.

Rémy

Reply via email to