tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <>
Subject Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Date Sun, 15 May 2005 09:57:12 GMT
Bill Barker wrote:
>> remm        2005/05/14 13:41:26
>>  Modified:    http11/src/java/org/apache/coyote/http11
>>  Log:
>>  - Optimize a little using a direct byte buffer to replace the socket 
>> buffer.
>>  - I'll experiment with doing the same optimization for reads, but I 
>> don't expect it to do anything
>>    (other than waste memory) as copying bytes will be needed.
> Cool.  I had been thinking that the savings with NIO were all do to the 
> fact that SocketChannel.write would allocate and copy to another 
> ByteBuffer instance if I didn't use direct ByteBuffers.

Yes, it's a little bit faster (the optimization seems a bit more 
efficient on Java 5, also). Not much difference, though, but it confirms 
virtually all the overhead is likely on JNI. I assume it is saving one 
copy of the bytes.

On input, saving a copy won't be possible, so I don't think it'll make a 
difference (maybe it will on Java 5, who knows), but I'll try it anyway.

Right now, with my localhost ab test on tomcat.gif (/usr/sbin/ab.exe -c 
20 -k -n 20000, Sun Java 5 server, 
Windows XP with no firewall), I'm at (in relative numbers): APR 1.00, 
regular IO 1.13

This is clearly the worst situation, however. Not doing localhost tests 
should hide some of the JNI overhead (as the network stack will actually 
have stuff to do), so I think the results are quite good overall.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message