Difference between revisions of "SUSE Manager/optimizing-apache-and-tomcat"

From MicroFocusInternationalWiki
Jump to: navigation, search
Line 1: Line 1:
==Introduction==
+
==Warning==
  
 +
<strong>These values should only be modified with support or consulting as these parameters can have severe and catastrophic performance impacts on your server when improperly adjusted. SUSE will not be able to provide support for catastrophic failure when these advanced parameters are modified without consultation. Tuning values for Apache httpd and Tomcat will require that you align these parameters with your server hardware and will most likely require further testing of these values within your environment.</strong>
  
 +
===Apache httpd's <code>MaxClients</code> parameter===
  
<strong>Note: These values should only be modified with support or consulting as these parameters can have severe and catastrophic performance impacts on your server when improperly adjusted. SUSE will not be able to provide support for catastrophic failure when these advanced parameters are modified without consultation. The Apache maxClients parameter must not be greater than Tomcat maxThreads parameter. Tuning values for Apache and Tomcat will require that you align these parameters with your server hardware and will most likely require further testing of these values within your environment.</strong>
+
The <code>MaxClients</code> setting determines the number of Apache httpd processes, and thus limits the number of client connections that can be made at the same time (SUSE Manager uses the pre-fork MultiProcessing Modules).
  
===Apache MaxClients Parameter===
+
The default value for <code>MaxClients</code> in SUSE Manager is 150. If you need to set the <code>MaxClients</code> value greater than 150, Apache httpd's <code>ServerLimit</code> setting and Tomcat's <code>maxThreads</code> must also be increased accordingly (see below).
  
The <strong>MaxClients</strong> setting determines the number of Apache processes, and thus the number of client connections that can be made (requirement: the pre-fork MultiProcessing Modules).
+
<strong>The Apache httpd <code>MaxClients</code> parameter must always be less or equal than Tomcat's <code>maxThreads</code> parameter!</strong>
The default Apache setting for MaxClients in SUSE Manager is 150. If you need to set the MaxClients value greater than 150, the <strong>ServerLimit</strong> setting must also be increased. If the MaxClients value is reached while the software is running, clients outside the MaxClients parameter value will be forced to wait and may time out. You can check the Apache error.log for details.
+
 
 +
If the <code>MaxClients</code> value is reached while the software is running, new client connections will be queued and forced to wait, this may result in timeouts. You can check the Apache httpd's <code>error.log</code> for details:
  
  
Line 14: Line 17:
  
  
The default MaxClients settings can be overridden in SUSE Manager by editing the server-tuning.conf file located at:
+
The default <code>MaxClients</code> settings can be overridden in SUSE Manager by editing the <code>server-tuning.conf</code> file located at:
  
 
     /etc/apache2/
 
     /etc/apache2/
  
Example server-tuning.conf file:
+
Example <code>server-tuning.conf</code> file:
  
 
     # prefork MPM
 
     # prefork MPM
Line 42: Line 45:
 
     </IfModule>
 
     </IfModule>
  
===Tomcat maxThreads Parameter===
+
===Tomcat's <code>maxThreads</code> parameter===
  
Tomcat <strong>maxThreads</strong> represents the maximum number of request processing threads to be created by the HTTPConnector. This value determines the maximum number of simultaneous requests that may be handled. The default value for SUSE Manager is 200 and should always be greater than the Apache MaxClients value if modified. The maxThreads value is located within the server.xml file located at:
+
Tomcat's <code>maxThreads</code> represents the maximum number of request processing threads that it will create. This value determines the maximum number of simultaneous requests that it is able to handle.
 +
 
 +
Note that all HTTP requests to the SUSE Manager server (from clients, browsers, XMLRPC API scripts, etc.) are handled by Apache httpd, and some of them are routed to Tomcat for futher processing. It is thus important that Tomcat is able to serve the same amount of simultaneous requests that Apache httpd is able to serve in the worst case.
 +
 
 +
The default value for SUSE Manager is 200 and should always be equal or greater than Apache httpd's <code>MaxClients</code>. The <code>maxThreads</code> value is located within the <code>server.xml</code> file located at:
 
     /etc/tomcat6
 
     /etc/tomcat6
  
Example server.xml file:
+
Example relevant lines in <code>server.xml</code>:
  
 
     <!-- Define an AJP 1.3 Connector on port 8009 -->
 
     <!-- Define an AJP 1.3 Connector on port 8009 -->
Line 55: Line 62:
 
===SUSE Manager Tuning Notes===
 
===SUSE Manager Tuning Notes===
  
 +
When configuring Apache httpd's <code>MaxClients</code> and Tomcat's <code>maxThreads</code> parameters you should also take into consideration the fact that each HTTP connection will need one or more database connections.
 +
 +
If the RDBMS is not able to serve an adequate amount of connections, issues will arise.
 +
 +
Please see the following equation for a rough calculation of the needed amount of database connections:
  
When configuring Apache MaxClients and Tomcat maxThreads it is not enough to keep Apache Maxclients lower than Tomcat maxThreads. You will need also need to ensure enough database connections are available. Please see the following equation for a rough calculation.
 
 
     ((3*$javamax) + $apachemax + 60)
 
     ((3*$javamax) + $apachemax + 60)

Revision as of 07:26, 6 August 2015

Warning

These values should only be modified with support or consulting as these parameters can have severe and catastrophic performance impacts on your server when improperly adjusted. SUSE will not be able to provide support for catastrophic failure when these advanced parameters are modified without consultation. Tuning values for Apache httpd and Tomcat will require that you align these parameters with your server hardware and will most likely require further testing of these values within your environment.

Apache httpd's MaxClients parameter

The MaxClients setting determines the number of Apache httpd processes, and thus limits the number of client connections that can be made at the same time (SUSE Manager uses the pre-fork MultiProcessing Modules).

The default value for MaxClients in SUSE Manager is 150. If you need to set the MaxClients value greater than 150, Apache httpd's ServerLimit setting and Tomcat's maxThreads must also be increased accordingly (see below).

The Apache httpd MaxClients parameter must always be less or equal than Tomcat's maxThreads parameter!

If the MaxClients value is reached while the software is running, new client connections will be queued and forced to wait, this may result in timeouts. You can check the Apache httpd's error.log for details:


[error] Server reached MaxClients setting, consider increasing the MaxClients setting


The default MaxClients settings can be overridden in SUSE Manager by editing the server-tuning.conf file located at:

   /etc/apache2/

Example server-tuning.conf file:

   # prefork MPM
   <IfModule prefork.c>
           # number of server processes to start
           # http://httpd.apache.org/docs/2.2/mod/mpm_common.html#startservers
           StartServers         5
           # minimum number of server processes which are kept spare
           # http://httpd.apache.org/docs/2.2/mod/prefork.html#minspareservers
           MinSpareServers      5
           # maximum number of server processes which are kept spare
           # http://httpd.apache.org/docs/2.2/mod/prefork.html#maxspareservers
           MaxSpareServers     10
           # highest possible MaxClients setting for the lifetime of the Apache process.
           # http://httpd.apache.org/docs/2.2/mod/mpm_common.html#serverlimit
           ServerLimit        150
           # maximum number of server processes allowed to start
           # http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients
           MaxClients         150
           # maximum number of requests a server process serves
           # http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxrequestsperchild
           MaxRequestsPerChild  10000
   </IfModule>

Tomcat's maxThreads parameter

Tomcat's maxThreads represents the maximum number of request processing threads that it will create. This value determines the maximum number of simultaneous requests that it is able to handle.

Note that all HTTP requests to the SUSE Manager server (from clients, browsers, XMLRPC API scripts, etc.) are handled by Apache httpd, and some of them are routed to Tomcat for futher processing. It is thus important that Tomcat is able to serve the same amount of simultaneous requests that Apache httpd is able to serve in the worst case.

The default value for SUSE Manager is 200 and should always be equal or greater than Apache httpd's MaxClients. The maxThreads value is located within the server.xml file located at:

   /etc/tomcat6

Example relevant lines in server.xml:

   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" address="127.0.0.1" maxThreads="200" connectionTimeout="20000"/>
   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" address="::1" maxThreads="200" connectionTimeout="20000"/>

SUSE Manager Tuning Notes

When configuring Apache httpd's MaxClients and Tomcat's maxThreads parameters you should also take into consideration the fact that each HTTP connection will need one or more database connections.

If the RDBMS is not able to serve an adequate amount of connections, issues will arise.

Please see the following equation for a rough calculation of the needed amount of database connections:

   ((3*$javamax) + $apachemax + 60)