Tomcat can use Apr to provide super scalability and performance, and better integrate local server technology. APR (Apache Portable Runtime) is a highly portable library, which is the core of Apache HTTP Server 2.x. APR has many functions, including access to advanced Io functions (such as sendfile, epoll, and OpenSSL), OS-level functions (Random Number Generation, system status, and so on), and local process management (shared memory, NT pipeline and Unix sockets ). These functions enable Tomcat as a common front-end web server to better integrate with other local web technologies. In general, Java is more efficient as a high-performance WEB server platform rather than simply as a backend container.
In the product environment, especially when Tomcat is directly used as a Web server, you should use Tomcat native to improve its performance. For detailed configuration and installation, see Tomcat documentation.
If noAPRTechnology, startTomcatThe following prompt is displayed:
Information: The APR based Apache Tomcat native library which allows optimal performance in production environments was not found on the java. library. path:/usr/Java/jdk1.6.0 _ 06/JRE/lib/i386/client:/usr/Java/jdk1.6.0 _ 06/JRE/lib/i386: /usr/Java/jdk1.6.0 _ 06/JRE /.. /lib/i386:/usr/Java/packages/lib/i386:/lib:/usr/lib
According to official instructions:
* APR Library
* OpenSSL Libraries
OpenSSL can be installed using Yum install OpenSSL-devel, or *. GZ downloaded from Apr.
Apr-1.3.2.tar.gz
Apr-util-1.3.2.tar.gz
Two can be found in the http://apache.mirror.phpchina.com/apr.
The tomcat-native.tar.gz can be found in the tomcat/bin directory.
Below isAPRConfiguration process:
InstallAPR
1. Tar zxvf apr-1.3.2.tar.gz
2. CD apr-1.3.2
3../configure
4. Make
5. Make install
APR is installed in/usr/local/APR by default.
InstallApr-util
1. Tar zxvf apr-util-1.3.2.tar.gz
2. CD apr-util-1.3.2
3../configure -- With-Apr =/usr/local/APR
4. Make
5. Make install
InstallTomcat-native
1. CD/usr/local/tomcat-6.0.18/bin
2. Tar zxvf tomcat-native.tar.gz
3. CD tomcat-native-1.1.14-src/JNI/native
4../configure -- With-Apr =/usr/local/APR -- With-Java-home =/usr/Java/jdk1.6.0 _ 11
5. Make
6. make install
SetAPREnvironment variables:
1. VI/etc/profile
2. Add the following content
Apr_home =/usr/local/APR/
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ apr_home/lib
Export LD_LIBRARY_PATH
3. Make the configuration take effect. Source/etc/profile
OtherwiseTomcatWe do not use the above setting method, but directlyTomcatOfBinUnderCatalina. ShAdd the following Configuration:
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/APR/lib
Export LD_LIBRARY_PATH
StartTomcatAfter,Check the log with the following line:
Information: Apr capabilities: ipv6 [True], sendfile [True], accept filters [false], random [True].
Bytes -------------------------------------------------------------------------------------------------
Create High-ThreadConnector:
<Connector Port = "8080" redirectport = "8443 ″
Maxthreads = "5000" Default 200
Minsparethreads = "1000" Default: 4 50
Maxsparethreads = "4000" Default: 50 100
Enablelookups = "false" Default Value: True
Acceptcount = "3500" Default Value: 10 50
Compression = "on" default off
Compressablem imetype = "text/html, text/XML, text/JavaScript, text/CSS, text/plain" default text/html, text/XML, text/plain
Connectiontimeout = "60000" Default 60000
DEBUG = "0 ″
Uriencoding = "UTF-8 ″
/>
Tomcat APR Configuration