TOMCAT8 Activate Apr operation mode (centos6.5)

Source: Internet
Author: User
Tags mkdir openssl tomcat apache tomcat

Tomcat has three modes of operation: BIO, NIO, Apr, and Tomcat operates in different modes with a large difference in operating efficiency. One, bio (Blockingio)

The blocking IO,TOMCAT6 and previous versions of the default operating mode, performance is very low, without any optimization processing. Second, NiO (noblocking IO)

Non-blocking IO,TOMCAT7 later versions of the default run mode, the use of Java asynchronous IO technology to improve the performance of Tomcat.

<connector port= "8080" protocol= "http/1.1"
               connectiontimeout= "20000"
               redirectport= "8543"/>

If you want to open the NIO mode in Tomcat6, directly modify the connector node in the Server.xml, modify the protocol to Org.apache.coyote.http11.Http11NioProtocol, the activation takes effect.

<connector port= "8080" 	           protocol= "Org.apache.coyote.http11.Http11NioProtocol"
               connectiontimeout= " 20000 "
               redirectport=" 8543 "/>

TOMCAT8 The default configuration starts after the last three lines of log are as follows:

http-nio-8180
ajp-nio-8109
Description runs in NiO mode by default.

Third, Apr (Apache portable Runtime)

From the operating system level to solve the asynchronous IO problem, greatly improve performance.

Apr and native must be installed and the APR will be supported directly on the launch. Install Apr

Apr requires Apr library and OpenSSL related libraries.

Yum Install Apr-devel Openssl-devel

Installing native

Enter the bin directory of Tomcat, for example:

/opt/soft/tomcat_8180/bin

Decompression Native Source Package

TAR-ZXVF tomcat-native.tar.gz
cd tomcat-native-1.1.32-src/jni/native
./configure--with-apr=/usr/bin/ Apr-1-config--with-java-home= "/opt/soft/jdk1.8.0_60"--with-ssl=yes make do
install
Native will be installed to/usr/local/apr/lib

We need to point the/usr/local/apr/lib/libtcnative-1.so.0.1.32 to the Tomcat-aware path. Configure the APR packet to a tomcat-recognizable path

15-apr-2016 22:18:54.209 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent the 
APR based Apache Tomcat Native Library which allows optimal performance in production environments is not found on the 
java.lib Rary.path:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

Tomcat8 default APR is on, configured in Server.xml

<listener classname= "Org.apache.catalina.core.AprLifecycleListener" sslengine= "on"/>
The APR mode does not start and automatically switches the startup NiO mode on because the OS is not installed Apr or the APR path does not refer to the path that Tomcat is recognized by default.

CD/USR
mkdir java
cd java/
mkdir packages
cd packages/
mkdir lib
cd lib/
mkdir
AMD64 CD amd64/

Link the/usr/local/apr/lib/libtcnative-1.so.0.1.32 to the directory created above.

Ln-s  /usr/local/apr/lib/libtcnative-1.so.0.1.32 libtcnative-1.so
ln-s  /usr/local/apr/lib/ libtcnative-1.so.0.1.32 libtcnative-1.so.0

Reboot Tomcat to see the last three lines of the boot log


http-apr-8180
ajp-apr-8109




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.