remm 2005/05/14 13:41:26
Modified: http11/src/java/org/apache/coyote/http11
InternalAprOutputBuffer.java
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 http://127.0.0.1:8080/tomcat.gif, 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.
Rémy
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]