What is the default value of maxThreads for HTTP/AJP Connector in JBoss EAP or Tomcat?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 4.x
- 5.x
- 6.x
- JBoss Application Server (AS) 4.0.x
- RHEL 6 Tomcat 6.0
Issue
- What value is used as default for "maxThreads" attribuite when it is not specified on JBossWeb's HTTP/AJP Connector in JBoss EAP?
- Where the default value for http connector is specified in
standalonefile in EAP 6 ? - What value is used as default for "maxThreads" attribuite when it is not specified on JBossWeb's HTTP/AJP Connector in Tomcat 6.0 in RHEL 6?
- What is default value of min/max thread in JBoss EAP 6? And where is this located? What is the default Min Thread value and is it possible to set one?
Resolution
AS 4.0.x:
- If
maxThreadsattribute is not specified on JBossWeb's HTTP/AJP Connector in$JBOSS_HOME/server/$PROFILE/deploy/jbossweb-tomcat55.sar/server.xml, it defaults to200.
EAP 4.x:
- If
maxThreadsattribute is not specified on JBossWeb's HTTP/AJP Connector in$JBOSS_HOME/server/$PROFILE/deploy/jboss-web.deployer/server.xml, it defaults to40.
EAP 5.x:
- If
maxThreadsattribute is not specified on JBossWeb's HTTP/AJP Connector in$JBOSS_HOME/server/$PROFILE/deploy/jbossweb.sar/server.xml, the following value is used:- EAP 5.0.0 - 5.1.0:
200for both default Java connector and native APR connector addon - EAP 5.1.1 onwards: Default is computed as:
512 * Runtime.getRuntime().availableProcessors()for default Java connector32 * Runtime.getRuntime().availableProcessors()for native APR connector addon
- EAP 5.0.0 - 5.1.0:
EAP 6.x:
- If the
max-connectionsattributes is not set on web subsystem connectors instandalone-(*).xml/domain.xml, default is computed as:512 * Runtime.getRuntime().availableProcessors()for default Java connector32 * Runtime.getRuntime().availableProcessors()for native APR connector addon
Tomcat 6.0 in RHEL 6:
- If
maxThreadsattribute is not specified on Tomcat HTTP/AJP<Connector>in/etc/tomcat6/server.xml, it defaults to200.
Diagnostic Steps
You can check the current value of maxThreads via JMX-Console. And you can check the default value from the source code. For example:
-
EAP 4.2/4.3 :
/** * Maximum amount of worker threads. */ protected int maxThreads = 40; public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; } -
EAP 5.0.0 - 5.1.0
/** * Maximum amount of worker threads. */ protected int maxThreads = 200; public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; } -
EAP 5.0.0- 5.1.0 with Native component:
/** * Maximum amount of worker threads. */ protected int maxThreads = 200; public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; } -
EAP 5.1.1 onwards:
/** * Maximum amount of worker threads. */ protected int maxThreads = 512 * Runtime.getRuntime().availableProcessors(); public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; } -
EAP 5.1.1 onwards with Native component:
/** * Maximum amount of worker threads. */ protected int maxThreads = 32 * Runtime.getRuntime().availableProcessors(); public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; } -
EAP 6.x:
/** * Maximum amount of worker threads. */ protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 64 : ((Constants.MAX_THREADS == -1) ? 512 * Runtime.getRuntime().availableProcessors() : Constants.MAX_THREADS); public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; }- Source code EAP 6.0.0 - JBOSSWEB_7_0_16_FINAL
- Source code EAP 6.0.1 - JBOSSWEB_7_0_17_FINAL
- Source code EAP 6.1.0 - JBOSSWEB_7_2_0_FINAL
- Source code EAP 6.1.1/6.2.0 - JBOSSWEB_7_2_2_FINAL
- Source code EAP 6.2.1 - JBOSSWEB_7_3_0_FINAL
- Source code EAP 6.2.2 - JBOSSWEB_7_3_1_FINAL
- Note : By default "
org.apache.tomcat.util.Constants.LOW_MEMORY = false" and "Constants.MAX_THREADS = -1". So "512 * Runtime.getRuntime().availableProcessors()" is picked as default.
-
EAP 6.x with Native component:
/** * Maximum amount of worker threads. */ protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 32 : ((Constants.MAX_THREADS == -1) ? 32 * Runtime.getRuntime().availableProcessors() : Constants.MAX_THREADS); public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public int getMaxThreads() { return maxThreads; }- Source code EAP 6.0.0 - JBOSSWEB_7_0_16_FINAL
- Source code EAP 6.0.1 - JBOSSWEB_7_0_17_FINAL
- Source code EAP 6.1.0 - JBOSSWEB_7_2_0_FINAL
- Source code EAP 6.1.1/6.2.0 - JBOSSWEB_7_2_2_FINAL
- Source code EAP 6.2.1 - JBOSSWEB_7_3_0_FINAL
- Source code EAP 6.2.2 - JBOSSWEB_7_3_1_FINAL
- Note : By default "
org.apache.tomcat.util.Constants.LOW_MEMORY = false" and "Constants.MAX_THREADS = -1". So "32 * Runtime.getRuntime().availableProcessors()" is picked as default.
-
There is no min-threads parameter to set minimum value of the thread pool.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments