2016-08-26 12:23 GMT+02:00 <violet...@apache.org>:

> Author: violetagg
> Date: Fri Aug 26 10:23:15 2016
> New Revision: 1757813
>
> URL: http://svn.apache.org/viewvc?rev=1757813&view=rev
> Log:
> Introduce a new method SocketWrapperBase.doWrite(boolean, ByteBuffer)
>
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>     tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
>     tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
>     tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
>
> I did examine adding some ByteBuffer write methods (as you can see in the
API), with gather writes in mind with NIO2 for HTTP/2, but:
- Since the other write method also exists, if the main buffer isn't empty,
there will be corruption. Let's say that's not a problem: the user is
supposed to know what it is doing and will have to flush :)
- A single buffer is most likely more memory efficient.
- I redid HTTP/2 with my async gather writes, minimizing contention more,
and ... the performance was measurably worse than the regular code. So I
gave up on it. Maybe reads will be more useful (no more blocking reads for
HTTP/2 headers, this is not really supposed to happen of course, but still
decent to have).
- When using SSL, the single buffer system is *way* better since it can be
a direct BB, which avoids a ton of allocation and buffer copies.

So I doubt this is more useful than my own additions, but on the positive
side, the changes are minimal.

Rémy

Reply via email to