remm 2003/07/29 11:53:20
Modified: http11/src/java/org/apache/coyote/http11
Http11Processor.java
Log:
- Reduce timeout and disable keepalive when the server starts running out
or processors (of course, if servlet processing times are too long, or is under
a DoS attack, it might still run out of processors).
- The policy is really simple, and could obviously be tweaked (and a flag can
be added to make it optional, etc).
Revision Changes Path
1.72 +10 -0
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
Index: Http11Processor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Http11Processor.java 13 Jul 2003 21:52:05 -0000 1.71
+++ Http11Processor.java 29 Jul 2003 18:53:20 -0000 1.72
@@ -589,6 +589,16 @@
int keepAliveLeft = maxKeepAliveRequests;
int soTimeout = socket.getSoTimeout();
+ float threadRatio =
+ (float) threadPool.getCurrentThreadsBusy()
+ / (float) threadPool.getMaxThreads();
+ if ((threadRatio > 0.33) && (threadRatio <= 0.66)) {
+ soTimeout = soTimeout / 5;
+ } else if (threadRatio > 0.66) {
+ soTimeout = soTimeout / 10;
+ keepAliveLeft = 1;
+ }
+
boolean keptAlive = false;
while (started && !error && keepAlive) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]