remm 2005/04/15 06:46:11 Modified: http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java InternalAprInputBuffer.java Log: - Fix my hack thanks to a trick from Mladen. Now performance is actually decent. Revision Changes Path 1.2 +0 -24 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java Index: Http11AprProcessor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Http11AprProcessor.java 14 Apr 2005 18:52:28 -0000 1.1 +++ Http11AprProcessor.java 15 Apr 2005 13:46:11 -0000 1.2 @@ -745,30 +745,6 @@ int keepAliveLeft = maxKeepAliveRequests; long soTimeout = endpoint.getSoTimeout(); - // FIXME: Should not be needed - /* - long oldSoTimeout = soTimeout; - int threadRatio = (endpoint.getCurrentThreadsBusy() * 100) - / endpoint.getMaxThreads(); - if ((threadRatio > 33) && (threadRatio <= 66)) { - soTimeout = soTimeout / 2; - } else if ((threadRatio > 66) && (threadRatio <= 90)) { - soTimeout = soTimeout / 3; - keepAliveLeft = 1; - } else if (threadRatio > 90) { - soTimeout = soTimeout / 20; - keepAliveLeft = 1; - } - - if (soTimeout != oldSoTimeout) { - try { - Socket.timeoutSet(socket, soTimeout); - } catch (Throwable t) { - log.debug("Error setting timeout", t); - error = true; - } - }*/ - boolean keptAlive = false; boolean openSocket = false; 1.3 +8 -28 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java Index: InternalAprInputBuffer.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InternalAprInputBuffer.java 14 Apr 2005 20:09:16 -0000 1.2 +++ InternalAprInputBuffer.java 15 Apr 2005 13:46:11 -0000 1.3 @@ -387,26 +387,16 @@ // Skipping blank lines // - if (keptAlive && pos >= lastValid) { - Socket.timeoutSet(socket, 0); - } - byte chr = 0; do { // Read new bytes if needed if (pos >= lastValid) { if (keptAlive) { - // Set socket in non blocking mode and try to read - int attempts = 0; - try { - while (attempts < 3 && !fill()) { - Thread.sleep(2); - attempts++; - } - } catch (InterruptedException e) { - // FIXME: do something - e.printStackTrace(); + // Do a simple read with a short timeout + int nRead = Socket.recvt(socket, buf, pos, buf.length - lastValid, 50000); + if (nRead > 0) { + lastValid = pos + nRead; } if (pos >= lastValid) { return false; @@ -427,26 +417,16 @@ start = pos; if (keptAlive && pos >= lastValid) { - // Set socket in non blocking mode and try to read - int attempts = 0; - try { - while (attempts < 3 && !fill()) { - Thread.sleep(2); - attempts++; - } - } catch (InterruptedException e) { - // FIXME: do something - e.printStackTrace(); + // Do a simple read with a short timeout + int nRead = Socket.recvt(socket, buf, pos, buf.length - lastValid, 50000); + if (nRead > 0) { + lastValid = pos + nRead; } if (pos >= lastValid) { return false; } } - if (keptAlive) { - Socket.timeoutSet(socket, timeout); - } - // // Reading the method name // Method name is always US-ASCII
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]