Author: markt Date: Thu May 5 15:01:46 2011 New Revision: 1099834 URL: http://svn.apache.org/viewvc?rev=1099834&view=rev Log: Add disableKeepAlivePercentage attribute to the HTTP-BIO connector
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/http.xml Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1099834&r1=1099833&r2=1099834&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Thu May 5 15:01:46 2011 @@ -118,6 +118,12 @@ public class Http11Processor extends Abs protected JIoEndpoint endpoint; + /** + * The percentage of threads that have to be in use before keep-alive is + * disabled to aid scalability. + */ + private int disableKeepAlivePercentage = 75; + // --------------------------------------------------------- Public Methods @@ -137,6 +143,16 @@ public class Http11Processor extends Abs } + public int getDisableKeepAlivePercentage() { + return disableKeepAlivePercentage; + } + + + public void setDisableKeepAlivePercentage(int disableKeepAlivePercentage) { + this.disableKeepAlivePercentage = disableKeepAlivePercentage; + } + + /** * Process pipelined HTTP requests on the specified socket. * @@ -181,8 +197,8 @@ public class Http11Processor extends Abs / endpoint.getMaxThreads(); } // Disable keep-alive if we are running low on threads - if (threadRatio > 75) { - keepAliveLeft = 1; + if (threadRatio > getDisableKeepAlivePercentage()) { + keepAliveLeft = 1; } try { Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java?rev=1099834&r1=1099833&r2=1099834&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Thu May 5 15:01:46 2011 @@ -82,6 +82,23 @@ public class Http11Protocol extends Abst protected Http11ConnectionHandler cHandler; + // ------------------------------------------------ HTTP specific properties + // ------------------------------------------ managed in the ProtocolHandler + + private int disableKeepAlivePercentage = 75; + public int getDisableKeepAlivePercentage() { + return disableKeepAlivePercentage; + } + public void setDisableKeepAlivePercentage(int disableKeepAlivePercentage) { + if (disableKeepAlivePercentage < 0) { + this.disableKeepAlivePercentage = 0; + } else if (disableKeepAlivePercentage > 100) { + this.disableKeepAlivePercentage = 100; + } else { + this.disableKeepAlivePercentage = disableKeepAlivePercentage; + } + } + // ----------------------------------------------------- JMX related methods @Override @@ -239,6 +256,8 @@ public class Http11Protocol extends Abst processor.setSocketBuffer(proto.getSocketBuffer()); processor.setMaxSavePostSize(proto.getMaxSavePostSize()); processor.setServer(proto.getServer()); + processor.setDisableKeepAlivePercentage( + proto.getDisableKeepAlivePercentage()); register(processor); return processor; } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1099834&r1=1099833&r2=1099834&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu May 5 15:01:46 2011 @@ -160,6 +160,11 @@ Improve handling in AJP connectors of the case where too large a AJP packet is received. (markt) </fix> + <fix> + Restore the automatic disabling of HTTP keep-alive with the BIO + connector once 75% of the processing threads are in use and make the + threshold configurable. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> Modified: tomcat/trunk/webapps/docs/config/http.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1099834&r1=1099833&r2=1099834&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/http.xml (original) +++ tomcat/trunk/webapps/docs/config/http.xml Thu May 5 15:01:46 2011 @@ -549,6 +549,14 @@ <attributes> + <attribute name="disableKeepAlivePercentage" required="false"> + <p>The percentage of processing threads that have to be in use before + HTTP keep-alives are disabled to improve scalability. Values less than + <code>0</code> will be changed to <code>0</code> and values greater than + <code>100</code> will be changed to <code>100</code>. If not specified, + the default value is <code>75</code>.</p> + </attribute> + <attribute name="maxConnections" required="false"> <p>The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org