Tomcat optimized configuration, description
One, concurrency optimization
1.JVM Tuning
The following is a 1G physical memory tomcat configuration:
Java_opts= "-server-xms512m-xmx512m-xss256k"
-server: Must be the first parameter, good performance on multiple CPUs
-XMS: Initial heap size, minimum memory used, higher CPU performance This value should be set to a larger
-xmx:java heap maximum, maximum memory used
Xms and XMX Two values are the minimum and maximum memory allocated for the JVM, depending on the size of the hardware physical memory, and are recommended to be half the physical memory.
-XSS: Stack size per thread
The following is a 32G physical memory tomcat configuration:
Java_opts= "-server-xms20480m-xmx20480m-xss1024k"
Second, Apr mode
Install Apr and tomcat-native
Yum-y Install Apr apr-devel
Enter the Tomcat/bin directory, such as:
cd/opt/local/tomcat/bin/
Tar xzfv tomcat-native.tar.gz
CD tomcat-native-1.1.32-src/jni/native/
./configure--with-apr=/usr/bin/apr-1-config
Make && make install
After successful installation, you will also need to set environment variables for tomcat by adding 1 rows to the catalina.sh file:
Catalina_opts= "-djava.library.path=/usr/local/apr/lib"
Modify the Conf/server.xml on the 8080 end
Protocol= "Org.apache.coyote.http11.Http11AprProtocol"
---------------------------------------------------------------------------------
<connector executor= "Tomcatthreadpool"
port= "8080"
Protocol= "Org.apache.coyote.http11.Http11AprProtocol"
connectiontimeout= "20000"
Enablelookups= "false"
Redirectport= "8443"
uriencoding= "UTF-8"/>
---------------------------------------------------------------------------------
PS: After startup, the view log shows that the APR mode is turned on as follows
INFO:APR Capabilities:ipv6 [True], sendfile [true], accept filters [FALSE], random [true].
Tomcat optimized configuration by. Java 8.0.25 Tomcat 7.0.59