From 2b4ebf158b6b0d1cc1d63ff704c4256c6858a561 Mon Sep 17 00:00:00 2001
From: markt
Date: Thu, 5 May 2011 15:53:57 +0000
Subject: [PATCH] Use maxThreads value as the default for maxConnections with
the BIO connector.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099855 13f79535-47bb-0310-9956-ffa450edef68
---
java/org/apache/tomcat/util/net/JIoEndpoint.java | 14 ++++++++++++
webapps/docs/config/ajp.xml | 14 ++++++++++++
webapps/docs/config/http.xml | 29 ++++++++++++------------
3 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/JIoEndpoint.java b/java/org/apache/tomcat/util/net/JIoEndpoint.java
index 4507430f6..440b7e64c 100644
--- a/java/org/apache/tomcat/util/net/JIoEndpoint.java
+++ b/java/org/apache/tomcat/util/net/JIoEndpoint.java
@@ -65,6 +65,14 @@ public class JIoEndpoint extends AbstractEndpoint {
protected ServerSocket serverSocket = null;
+ // ------------------------------------------------------------ Constructor
+
+ public JIoEndpoint() {
+ // Set maxConnections to zero so we can tell if the user has specified
+ // their own value on the connector when we reach bind()
+ setMaxConnections(0);
+ }
+
// ------------------------------------------------------------- Properties
/**
@@ -351,6 +359,12 @@ public class JIoEndpoint extends AbstractEndpoint {
if (acceptorThreadCount == 0) {
acceptorThreadCount = 1;
}
+ // Initialize maxConnections
+ if (getMaxConnections() == 0) {
+ // User hasn't set a value - use the default
+ setMaxConnections(getMaxThreads());
+ }
+
if (serverSocketFactory == null) {
if (isSSLEnabled()) {
serverSocketFactory =
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 08ed2bff5..ccc13a6cf 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -314,6 +314,20 @@
connectionTimeout attribute.
+
+
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 acceptCount setting. Default value
+ varies by connector type. For BIO the default is the value of
+ maxThreads.For APR/native, the default is
+ 8192.
+
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.
+
+
The maximum number of request processing threads to be created
by this Connector, which therefore determines the
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 425407123..4f999d506 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -356,8 +356,9 @@
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 acceptCount setting. Default value
- varies by connector type. For BIO and NIO the default is
- 10000. For APR/native, the default is 8192.
+ varies by connector type. For BIO the default is the value of
+ maxThreads. For NIO the default is 10000.
+ For APR/native, the default is 8192.
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.
@@ -1173,18 +1174,18 @@
Below is a small chart that shows how the connectors differentiate.
- Java Blocking Connector Java Nio Blocking Connector APR/native Connector
- BIO NIO APR
- Classname Http11Protocol Http11NioProtocol Http11AprProtocol
- Tomcat Version 3.x onwards 6.x onwards 5.5.x onwards
- Support Polling NO YES YES
- Polling Size N/A Unlimited - Restricted by mem Unlimited - Configurable
- Read HTTP Request Blocking Non Blocking Blocking
- Read HTTP Body Blocking Sim Blocking Blocking
- Write HTTP Response Blocking Sim Blocking Blocking
- SSL Support Java SSL Java SSL OpenSSL
- SSL Handshake Blocking Non blocking Blocking
- Max Connections maxConnections See polling size See polling size
+ Java Blocking Connector Java Nio Blocking Connector APR/native Connector
+ BIO NIO APR
+ Classname Http11Protocol Http11NioProtocol Http11AprProtocol
+ Tomcat Version 3.x onwards 6.x onwards 5.5.x onwards
+ Support Polling NO YES YES
+ Polling Size N/A maxConnections maxConnections
+ Read HTTP Request Blocking Non Blocking Blocking
+ Read HTTP Body Blocking Sim Blocking Blocking
+ Write HTTP Response Blocking Sim Blocking Blocking
+ SSL Support Java SSL Java SSL OpenSSL
+ SSL Handshake Blocking Non blocking Blocking
+ Max Connections maxConnections maxConnections maxConnections
--
2.11.0