You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2007/03/28 16:01:54 UTC
svn commit: r523331 - in /tomcat/tc6.0.x/trunk/java/org/apache: coyote/ajp/
coyote/http11/ tomcat/util/net/
Author: remm
Date: Wed Mar 28 07:01:53 2007
New Revision: 523331
URL: http://svn.apache.org/viewvc?view=rev&rev=523331
Log:
- The poller now has good performance, so remove firstReadTimeout (the algorithm can still be retrieved from
svn if needed).
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed Mar 28 07:01:53 2007
@@ -90,13 +90,6 @@
responseHeaderMessage = new AjpMessage(packetSize);
bodyMessage = new AjpMessage(packetSize);
- readTimeout = endpoint.getFirstReadTimeout() * 1000;
- if (readTimeout == 0) {
- readTimeout = 100 * 1000;
- } else if (readTimeout < 0) {
- readTimeout = -1;
- }
-
// Allocate input and output buffers
inputBuffer = ByteBuffer.allocateDirect(packetSize * 2);
inputBuffer.limit(0);
@@ -189,13 +182,6 @@
/**
- * The socket timeout used when reading the first block of the request
- * header.
- */
- protected long readTimeout;
-
-
- /**
* Temp message bytes used for processing.
*/
protected MessageBytes tmpMB = MessageBytes.newInstance();
@@ -371,11 +357,6 @@
// Error flag
error = false;
- int limit = 0;
- if (endpoint.getFirstReadTimeout() > 0) {
- limit = endpoint.getMaxThreads() / 2;
- }
-
boolean openSocket = true;
boolean keptAlive = false;
@@ -384,8 +365,7 @@
// Parsing the request header
try {
// Get first message of the request
- if (!readMessage(requestHeaderMessage, true,
- keptAlive && (endpoint.getCurrentThreadsBusy() >= limit))) {
+ if (!readMessage(requestHeaderMessage, true, keptAlive)) {
// This means that no data is available right now
// (long keepalive), so that the processor should be recycled
// and the method should return true
@@ -1061,15 +1041,9 @@
}
int nRead;
while (inputBuffer.remaining() < n) {
- if (readTimeout > 0) {
- nRead = Socket.recvbbt
- (socket, inputBuffer.limit(),
- inputBuffer.capacity() - inputBuffer.limit(), readTimeout);
- } else {
- nRead = Socket.recvbb
- (socket, inputBuffer.limit(),
- inputBuffer.capacity() - inputBuffer.limit());
- }
+ nRead = Socket.recvbb
+ (socket, inputBuffer.limit(),
+ inputBuffer.capacity() - inputBuffer.limit());
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Wed Mar 28 07:01:53 2007
@@ -364,17 +364,6 @@
}
- public int getFirstReadTimeout() {
- return ep.getFirstReadTimeout();
- }
-
-
- public void setFirstReadTimeout(int i) {
- ep.setFirstReadTimeout(i);
- setAttribute("firstReadTimeout", "" + i);
- }
-
-
public int getPollTime() {
return ep.getPollTime();
}
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Wed Mar 28 07:01:53 2007
@@ -87,14 +87,7 @@
this.endpoint = endpoint;
request = new Request();
- int readTimeout = endpoint.getFirstReadTimeout();
- if (readTimeout == 0) {
- readTimeout = 100;
- } else if (readTimeout < 0) {
- readTimeout = -1;
- }
- inputBuffer = new InternalAprInputBuffer(request, headerBufferSize,
- readTimeout);
+ inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
request.setInputBuffer(inputBuffer);
response = new Response();
@@ -800,11 +793,6 @@
int keepAliveLeft = maxKeepAliveRequests;
long soTimeout = endpoint.getSoTimeout();
- int limit = 0;
- if (endpoint.getFirstReadTimeout() > 0 || endpoint.getFirstReadTimeout() < -1) {
- limit = endpoint.getMaxThreads() / 2;
- }
-
boolean keptAlive = false;
boolean openSocket = false;
@@ -815,8 +803,7 @@
if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
Socket.timeoutSet(socket, soTimeout * 1000);
}
- if (!inputBuffer.parseRequestLine
- (keptAlive && (endpoint.getCurrentThreadsBusy() >= limit))) {
+ if (!inputBuffer.parseRequestLine(keptAlive)) {
// This means that no data is available right now
// (long keepalive), so that the processor should be recycled
// and the method should return true
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Wed Mar 28 07:01:53 2007
@@ -264,15 +264,6 @@
setAttribute("port", "" + port);
}
- public int getFirstReadTimeout() {
- return ep.getFirstReadTimeout();
- }
-
- public void setFirstReadTimeout( int i ) {
- ep.setFirstReadTimeout(i);
- setAttribute("firstReadTimeout", "" + i);
- }
-
public int getPollTime() {
return ep.getPollTime();
}
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Wed Mar 28 07:01:53 2007
@@ -51,8 +51,7 @@
/**
* Alternate constructor.
*/
- public InternalAprInputBuffer(Request request, int headerBufferSize,
- long readTimeout) {
+ public InternalAprInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
@@ -73,12 +72,6 @@
parsingHeader = true;
swallowInput = true;
- if (readTimeout < 0) {
- this.readTimeout = -1;
- } else {
- this.readTimeout = readTimeout * 1000;
- }
-
}
@@ -181,13 +174,6 @@
protected int lastActiveFilter;
- /**
- * The socket timeout used when reading the first block of the request
- * header.
- */
- protected long readTimeout;
-
-
// ------------------------------------------------------------- Properties
@@ -381,26 +367,8 @@
if (useAvailableData) {
return false;
}
- if (readTimeout == -1) {
- if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
- } else {
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
- } else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
- return false;
- } else {
- throw new IOException(sm.getString("iib.failedread"));
- }
- }
- }
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
}
chr = buf[pos++];
@@ -416,26 +384,8 @@
if (useAvailableData) {
return false;
}
- if (readTimeout == -1) {
- if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
- } else {
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
- } else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
- return false;
- } else {
- throw new IOException(sm.getString("iib.failedread"));
- }
- }
- }
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
}
//
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?view=diff&rev=523331&r1=523330&r2=523331
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 28 07:01:53 2007
@@ -272,14 +272,6 @@
/**
- * Timeout on first request read before going to the poller, in ms.
- */
- protected int firstReadTimeout = -1;
- public int getFirstReadTimeout() { return firstReadTimeout; }
- public void setFirstReadTimeout(int firstReadTimeout) { this.firstReadTimeout = firstReadTimeout; }
-
-
- /**
* Poll interval, in microseconds. The smaller the value, the more CPU the poller
* will use, but the more responsive to activity it will be.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org