Tomcat Threads Test
The Http connector in the Tomcat Web server represents a Connector component that supports the HTTP/1.1 protocol, which enables Catalina to function as a stand-alone web server, besides its ability to execute servlets and JSP pages. A particular instance of this component listens for connections on a specific TCP port number on the server to perform request processing and response creation. You can have one or more such Connectors configured to form a part of a single Service with each forwarding service to the associated Engine.
As soon as your server startup time is up, this Connector will create a number of request processing threads which are based on the value configured for the minSpareThreads attribute. Each incoming request requires a thread for the duration of that request. If more simultaneous requests are received than can be handled by the currently available request processing threads, additional threads will be created up to the configured maximum (the value of the maxThreads attribute). If still more simultaneous requests are received, they are stacked up inside the server socket created by the Connector, up to the configured maximum (the value of the acceptCount attribute). Any further simultaneous requests will receive "connection refused" errors, until resources are available to process them.
Continuous monitoring of thread pools is imperative to ensure the smooth transaction of business on the Tomcat web server. The Tomcat Threads test periodically observes thread pool usage to proactively determine inadequacies in the allocation of threads to the pool, and to predict future thread requirements.
Target of the test : A Tomcat Server
Agent deploying the test : An internal agent
Outputs of the test : One set of results for each thread pool managed by the Tomcat server being monitored.
Parameter | Description |
---|---|
Test Period |
How often should the test be executed. |
Host |
The IP address of the host for which this test is to be configured. |
Port |
Refers to the port at which the specified host listens to. |
Measurement Mode |
This test can extract metrics from Tomcat using either of the following mechanisms:
To configure the test to use egtomcat.war file, first select the War file option. Then, refer to the Deploying a WAR File to Monitor the Tomcat Server to know how to deploy the WAR file on the target Tomcat server. On the other hand, if you want the test to use JMX instead, then first, select the JMX option. Then, follow the procedure detailed in the Using JMX to Monitor the Tomcat Server/JVM to configure the test to use jmx. By default, the JMX option is chosen here. |
JMX Remote Port |
This parameter appears only if the Measurement Mode is set to JMX. Here, specify the port at which the JMX listens for requests from remote hosts. Ensure that you specify the same port that you configured in the catalina.sh (or catalina.bat) file in the <CATALINA_HOME_DIR>/bin folder of the target Tomcat server (refer to the Using JMX to Monitor the Tomcat Server/JVM for more details). |
JMX User, JMX Password, and Confirm Password |
These parameters appear only if the Measurement Mode is set to JMX. If JMX equires authentication only (but no security), then ensure that the JMX User and JMX Password parameters are configured with the credentials of a user with read-write access to JMX. To know how to create this user, refer to the Using JMX to Monitor the Tomcat Server/JVM. Confirm the password by retyping it in the Confirm Password text box. |
JNDIName |
This parameter appears only if the Measurement Mode is set to JMX. The JNDIName is a lookup name for connecting to the JMX connector. By default, this is jmxrmi. If you have registered the JMX connector in the RMI registery using a different lookup name, then you can change this default value to reflect the same. |
Provider |
This parameter appears only if the Measurement Mode is set to JMX. This test uses a JMX Provider to access the MBean attributes of the target Java application and collect metrics. Specify the package name of this JMX Provider here. By default, this is set to com.sun.jmx.remote.protocol. |
SSL |
This parameter appears only if the Measurement Mode is set to War File. Indicate Yes if the Tomcat server is SSL-enabled. |
URL |
This parameter appears only if the Measurement Mode is set to War File. Specify the URL of the managed Tomcat server to enable the test to connect to it and extract measures from it. The URL specification should be of the format: http://{TomcatIP}:{TomcatPort}. |
UserName, Password, and Confirm Password |
These parameters appear only if the Measurement Mode is set to War File. In the UserName text box, specify a name of a user who has been assigned the Manager role on the Tomcat server to be monitored; these users are typically allowed to control web applications deployed on the Tomcat server. Specify the Password of this user, and confirm the password by retyping it in the Confirm Password text box. |
EncryptPass |
This parameter appears only if the measurement modeis set to War File. Select Yes if you want to encrypt the password. |
Timeout |
Specify the duration (in seconds) for which this test should wait for a response from Tomcat. If there is no response from Tomcat beyond the configured duration, the test will timeout. By default, this is set to 240 seconds. |
Measurement | Description | Measurement Unit | Interpretation |
---|---|---|---|
Thread count |
Indicates the number of threads that are currently assigned to a connector. |
Number |
|
Threads busy |
Indicates the number of threads which are currently busy in processing requests. |
Number |
A high value for this measure indicates that there is hectic activity at the connector level. |
Max threads |
Indicates the maximum number of threads that this pool can contain. |
Number |
In the Tomcat server, a maxThreads attribute can be set for every connector to indicate the maximum number of simultaneous requests that can be handled by that connector. This measure reports this maxThreads value. The default maxThreads value for a connector is 200. If the value of the Thread count measure grows close to the value of this measure, it indicates that the number of threads in the pool needs to be increased for effective operation of this application. Alternatively, you may also consider changing the maximum number of threads that a pool can contain. However, exercise caution when altering the maximum thread count, as a very high thread count can cause the app to slowdown from excessive memory usage. Likewise, if the maximum thread count is set too low, it will cause requests to block or timeout. |
Max spare threads |
Indicates the maximum number of spare threads that can exist in a thread pool. |
Number |
Ideally for a connector, the default value is set to 50, which will determine the maximum number of unused request processing threads that will be allowed to exist until the thread pool starts stopping the unnecessary threads. |
Min spare threads |
Indicates the minimum number of spare threads that are currently available for processing requests. |
Number |
Generally, for a connector, the default value for this parameter is set to 4, which is less than the value set in maxThreads. This attribute will determine the number of request processing threads that will be created when this Connector is first started. The connector will also make sure it has the specified number of idle processing threads available. |