Author: markt Date: Thu May 5 15:42:59 2011 New Revision: 1099850 URL: http://svn.apache.org/viewvc?rev=1099850&view=rev Log: Merge maxConnections and pollerSize for the APR connectors.
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/http.xml Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=1099850&r1=1099849&r2=1099850&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Thu May 5 15:42:59 2011 @@ -94,8 +94,9 @@ public class AjpAprProtocol extends Abst public int getPollTime() { return ((AprEndpoint)endpoint).getPollTime(); } public void setPollTime(int pollTime) { ((AprEndpoint)endpoint).setPollTime(pollTime); } - public void setPollerSize(int pollerSize) { ((AprEndpoint)endpoint).setPollerSize(pollerSize); } - public int getPollerSize() { return ((AprEndpoint)endpoint).getPollerSize(); } + // pollerSize is now a synonym for maxConnections + public void setPollerSize(int pollerSize) { endpoint.setMaxConnections(pollerSize); } + public int getPollerSize() { return endpoint.getMaxConnections(); } // ----------------------------------------------------- JMX related methods Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1099850&r1=1099849&r2=1099850&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Thu May 5 15:42:59 2011 @@ -86,8 +86,8 @@ public class Http11AprProtocol extends A public int getPollTime() { return ((AprEndpoint)endpoint).getPollTime(); } public void setPollTime(int pollTime) { ((AprEndpoint)endpoint).setPollTime(pollTime); } - public void setPollerSize(int pollerSize) { ((AprEndpoint)endpoint).setPollerSize(pollerSize); } - public int getPollerSize() { return ((AprEndpoint)endpoint).getPollerSize(); } + public void setPollerSize(int pollerSize) { endpoint.setMaxConnections(pollerSize); } + public int getPollerSize() { return endpoint.getMaxConnections(); } public void setPollerThreadCount(int pollerThreadCount) { ((AprEndpoint)endpoint).setPollerThreadCount(pollerThreadCount); } public int getPollerThreadCount() { return ((AprEndpoint)endpoint).getPollerThreadCount(); } Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1099850&r1=1099849&r2=1099850&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu May 5 15:42:59 2011 @@ -99,6 +99,14 @@ public class AprEndpoint extends Abstrac protected ConcurrentLinkedQueue<SocketWrapper<Long>> waitingRequests = new ConcurrentLinkedQueue<SocketWrapper<Long>>(); + // ------------------------------------------------------------ Constructor + + public AprEndpoint() { + // Need to override the default for maxConnections to align it with what + // was pollerSize (before the two were merged) + setMaxConnections(8 * 1024); + } + // ------------------------------------------------------------- Properties @@ -112,14 +120,6 @@ public class AprEndpoint extends Abstrac /** - * Size of the socket poller. - */ - protected int pollerSize = 8 * 1024; - public void setPollerSize(int pollerSize) { this.pollerSize = pollerSize; } - public int getPollerSize() { return pollerSize; } - - - /** * Size of the sendfile (= concurrent files which can be served). */ protected int sendfileSize = 1 * 1024; @@ -428,11 +428,12 @@ public class AprEndpoint extends Abstrac acceptorThreadCount = 1; } if (pollerThreadCount == 0) { - if ((OS.IS_WIN32 || OS.IS_WIN64) && (pollerSize > 1024)) { + if ((OS.IS_WIN32 || OS.IS_WIN64) && (getMaxConnections() > 1024)) { // The maximum per poller to get reasonable performance is 1024 - pollerThreadCount = pollerSize / 1024; + pollerThreadCount = getMaxConnections() / 1024; // Adjust poller size so that it won't reach the limit - pollerSize = pollerSize - (pollerSize % 1024); + setMaxConnections( + getMaxConnections() - (getMaxConnections() % 1024)); } else { // No explicit poller size limitation pollerThreadCount = 1; @@ -1083,7 +1084,7 @@ public class AprEndpoint extends Abstrac */ protected void init() { pool = Pool.create(serverSockPool); - int size = pollerSize / pollerThreadCount; + int size = getMaxConnections() / pollerThreadCount; int timeout = getKeepAliveTimeout(); if (timeout <= 0) { timeout = socketProperties.getSoTimeout(); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1099850&r1=1099849&r2=1099850&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu May 5 15:42:59 2011 @@ -165,6 +165,10 @@ connector once 75% of the processing threads are in use and make the threshold configurable. (markt) </fix> + <fix> + Make pollerSize and maxConnections synonyms for the APR connectors since + they perform the same function. (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=1099850&r1=1099849&r2=1099850&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/http.xml (original) +++ tomcat/trunk/webapps/docs/config/http.xml Thu May 5 15:42:59 2011 @@ -350,6 +350,19 @@ <strong>connectionTimeout</strong> attribute.</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 + will not accept any more connections until the number of connections + falls below this value. The operating system may still accept + connections based on the <code>acceptCount</code> setting. Default value + varies by connector type. For BIO and NIO the default is + <code>10000</code>. For APR/native, the default is <code>8192</code>.</p> + <p>Note that for APR/native on Windows, the configured value will be + reduced to the highest multiple of 1024 that is less than or equal to + maxConnections. This is done for performance reasons.</p> + </attribute> + <attribute name="maxHttpHeaderSize" required="false"> <p>The maximum size of the request and response HTTP header, specified in bytes. If not specified, this attribute is set to 8192 (8 KB).</p> @@ -557,15 +570,6 @@ 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 - will not accept any more connections until the number of connections - falls below this value. The operating system may still accept - connections based on the <code>acceptCount</code> setting. Default value - is <code>10000</code>.</p> - </attribute> - </attributes> </subsection> @@ -740,7 +744,7 @@ <p>Amount of sockets that the poller responsible for polling kept alive connections can hold at a given time. Extra connections will be closed right away. The default value is 8192, corresponding to 8192 keep-alive - connections.</p> + connections. This is a synonym for maxConnections.</p> </attribute> <attribute name="pollerThreadCount" required="false"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org