Tomcat optimized configuration by. Java 8.0.25 Tomcat 7.0.59

Source: Internet
Author: User
Tags xms

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.