thin tomcat and configuration files
Download Tomcat and Unzip 1) remove unwanted management apps and help apps to improve Tomcat security
Delete all files under WebApps
# RM–FR $CATALINA _home/webapps/*
Delete all files under Server/wenapps (this directory is not found in the tomcat-6.0.37 version)
# RM–FR $CATALINA _home/server/webapps/* 2) Thin Sever.xml profile
Use the minimum profile in the Tomcat release version to improve performance if there are functional requirements on a per-join feature configuration.
Back up the original server.xml to Server.xml_bak
# MV Server.xml Server.xml_bak
Copy Server-minimal.xml to Server.xml
# CP Server-minimal.xml Server.xml (not found Server-minimal.xml, here's my simplification process)
Open Server.xml, delete globalnamingresources and realm tomcat memory settings
In the Windows environment, modify the "%tomcat_home%\bin\catalina.bat" file and add the following settings at the beginning of the file: set JAVA_OPTS=-XMS256M-XMX512M-XX:PERMSIZE=128M-XX: maxnewsize=256m-xx:maxpermsize=256m
In the Linux environment, modify the "%tomcat_home%\bin\catalina.sh" file and add the following settings at the beginning of the file: java_opts= '-xms256m-xmx512m-xx:permsize=128m-xx: Maxnewsize=256m-xx:maxpermsize=256m '
Description
-XMS setting the initial memory size
-XMX setting the maximum memory that can be used
-XMN: Minimum memory value,-xmn128-256m is enough
The initial memory allocated by the JVM is specified by-XMS, the default is physical memory 1/64;JVM the maximum allocated memory is specified by-XMX, which defaults to 1/4 of the physical memory. When the default free heap memory is less than 40%, the JVM increases the heap until the maximum limit of-xmx, and when the free heap memory is greater than 70%, the JVM reduces the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.
In larger application projects, the default memory is not sufficient and may cause the system to fail to run. A common problem is to report a Tomcat memory overflow error "Java.lang.OutOfMemoryError:Java Heap Space, which causes the client to display a 500 error.
-xx:permsize=128m
-xx:maxpermsize=256m, default is 32M
Permsize/maxpermsize: Defines the size of the perm segment, permsize the memory size perm when the JVM starts, and maxpermsize the maximum amount of perm memory that can be occupied.
PermGen space is the full name of permanent Generation space, refers to the memory of the permanent storage area, this block of memory is mainly stored by the JVM class and meta information, class is loader will be placed in PermGen Space, unlike the heap area where the class instance (Instance) is stored, the GC (garbage Collection) does not clean up permgen space during the main program run time, so if you have a class in your application, you are likely to appear "Java.lang.OutOfMemoryError:PermGen SpaceError
Concurrency number setting
<connector port= "8080" protocol= "http/1.1"
maxtreads= "minsparethreads=" maxsparethreads= "150"
Acceptcount= "50"
Enablelookups= "false"
connectiontimeout= "20000" uriencoding= "UTF-8"
redirectport= "8443"/>
Description
maxthreads= "256"///maximum number of threads
minsparethreads= "30"///Initialize the number of threads created at
maxsparethreads= "150"///Once the thread is created exceeds this value, Tomcat shuts down the socket thread that is no longer needed.
acceptcount= "700"//Specifies the number of requests that can be placed in the processing queue when all the threads that can be used to process requests are used, and requests that exceed this number will not be processed
Maxthread too much, resulting in excessive switching and severe performance degradation. This quantity should be the load-carrying capacity of your individual machine and the result of the stress test. Do not increase arbitrarily. In general, 256-512 are already very high values.