costin 02/05/22 16:51:11 Modified: jk/java/org/apache/jk/common ChannelSocket.java Log: Added ( unused ) BUFFERED_WRITE. When 4.x and 3.x will support the CLIENT_FLUSH notification we'll get some 10-20% speed improvements. Revision Changes Path 1.14 +24 -1 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java Index: ChannelSocket.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ChannelSocket.java 14 May 2002 20:45:19 -0000 1.13 +++ ChannelSocket.java 22 May 2002 23:51:11 -0000 1.14 @@ -107,6 +107,13 @@ int linger=100; int socketTimeout; + /* Turning this to true will reduce the latency with about 20%. + But it requires changes in tomcat to make sure client-requested + flush() is honored ( on my test, I got 367->433 RPS and + 52->35ms average time with a simple servlet ) + */ + static final boolean BUFFER_WRITE=false; + ThreadPool tp=new ThreadPool(); /* ==================== Tcp socket options ==================== */ @@ -190,7 +197,11 @@ s.setSoTimeout( socketTimeout ); InputStream is=new BufferedInputStream(s.getInputStream()); - OutputStream os= s.getOutputStream(); + OutputStream os; + if( BUFFER_WRITE ) + os = new BufferedOutputStream( s.getOutputStream()); + else + os = s.getOutputStream(); ep.setNote( isNote, is ); ep.setNote( osNote, os ); } @@ -289,6 +300,16 @@ return len; } + public int flush( Msg msg, MsgContext ep) + throws IOException + { + if( BUFFER_WRITE ) { + OutputStream os=(OutputStream)ep.getNote( osNote ); + os.flush(); + } + return 0; + } + public int receive( Msg msg, MsgContext ep ) throws IOException { @@ -451,6 +472,8 @@ return receive( msg, ep ); case JkHandler.HANDLE_SEND_PACKET: return send( msg, ep ); + case JkHandler.HANDLE_FLUSH: + return flush( msg, ep ); } return next.invoke( msg, ep );
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>