web123456

Tomcat common optimization configuration

TomcatCommonly used optimized configurations:

  1. memory space


/etc/sysconfig/tomcat (rpm package installation)
catalina.out (BASEDIR/ , expand package)
在这里插入图片描述

JAVA_OPTS="-server -Xms32g -Xmx32g"
  • 1
       Description:
        -server: use the server model
        -Xms: heap memory initialization size (recommended to be consistent with -Xmx)
        -Xmx: heap memory space limit (max 32G for a single tomcat instance)
        -XX:NewSize: initialization size of new generation space
        -XX:MaxNewSize: maximum size of new generation space
        -XX:PermSize:MaxPermSize:MaxPermSize.
        -XX:MaxPermSize:MaxPermSize:MaxPermSize.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  1. Thread Pool Settings
    <Connector port="8080" protocol="HTTP/1.1" maxThreads="200" connectionTimeout="20000" redirectPort="8443" />
  • 1

Common Properties:
maxThreads: maximum number of threads
minSpareThreads: Minimum number of free threads.
maxSpareThreads: maximum number of idle threads
acceptCount: the maximum length of the waiting queue
URIEncoding: URI address encoding format, UTF-8 is recommended.
enableLookups: whether to enable DNS resolution, recommended off
compression: Enable or disable compressed transmission.
compressionMinSize: the minimum size of the data stream to enable compressed transmission, in bytes
compressableMimeType: defines the MIME type that enables compression (text/html,text/xml,text/css,text/css, text/html,text/xml,text/xml,text/xml,text/css,text/css,text/css,text/css,text/css,text/css).javascript

  1. Disable port 8005
<Server port="-1" shutdown="SHUTDOWN">
  • 1
  1. Hide version information
 <Connector port="8080" protocol="HTTP/1.1 connectionTimeout="20000" redirectPort="8443" Server="our server"/>
  • 1

Description :
Server= "An arbitrarily defined string."