tomcat tuning and jvm parameter tuning

Tomcat tuning

First, open Tomcat / conf / server XML file, search Executor name = "tomcatThreadPool", open and adjust to:

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="500" minSpareThreads="20" maxSpareThreads="50" maxIdleTime="60000"/>

Then, modify the < connector... > node, add the executor attribute, search port = "80", and adjust to:

<Connector executor="tomcatThreadPool"
compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,image/gif,image/jpg,image/png" redirectPort="8443" />

Parameter Description:

  1. port: port
  2. connectionTimeout: network connection timeout, unit: milliseconds. Setting to 0 means never timeout. This setting has hidden dangers. It can usually be set to 30000 milliseconds.
  3. enableLookups: if true, you can call request Getremotehost() performs DNS query to get the actual host name of the remote client. If it is false, DNS query will not be performed, but its ip address will be returned.
  4. keepAliveTimeout: maximum holding time of long connection (MS). Here is 15 seconds.
  5. maxKeepAliveRequests: maximum number of long connections (1 = disabled, - 1 = unlimited number, 100 by default. Generally set between 100 and 200)
  6. maxHttpHeaderSize: the maximum size of http request header information. The part exceeding this length will not be processed. Generally 8K.
  7. URIEncoding: - specifies the URL encoding format of the Tomcat container.
  8. acceptCount: Specifies the number of requests that can be put into the processing queue when all available threads for processing requests are used. Requests exceeding this number will not be processed. The default is 10.
  9. disableUploadTimeout: whether to use the timeout mechanism when uploading.
  10. enableLookups: whether to reverse query the domain name. The value is: true or false. To improve processing power, it should be set to false.
  11. bufferSize: defines the size (in bytes) of the buffer to be provided for input streams created by this connector. By default, buffers of 2048 bytes are provided.
  12. maxSpareThreads: the maximum number of idle connections. Once the created thread exceeds this value, Tomcat will close the socket thread that is no longer needed.
  13. maxThreads: the maximum number of connections processed simultaneously. Tomcat uses threads to process each request received. This value represents the maximum number of threads that Tomcat can create.
  14. minSpareThreads: minimum number of idle threads, the number of threads created during Tomcat initialization.
  15. minProcessors: the minimum number of idle connection threads. It is used to improve system processing performance. The default value is 10. (used in Tomcat4)
  16. maxProcessors: the maximum number of connection threads, that is, the maximum number of concurrent requests. The default value is 75. (used in Tomcat4)
  17. maxIdleTime: the maximum idle time of the thread.

JVM tuning

Windows opens Tomcat / bin / Catalina Bat, linux, open Tomcat / bin / Catalina SH file, such as linux - add the following parameters in the first line:


Keywords: Java Linux Tomcat

Added by Sinikka on Thu, 10 Mar 2022 06:14:07 +0200