Apache Portable Runtime (APR) based Native library for tomcattable of Contents
- Introduction
- Installation
- Windows
- Linux
- APR components
- APR Lifecycle Listener Configuration
- APR Connectors Configuration
- Http/https
- AJP
Introduction
Tomcat can provide higher performance, higher scalability, and better local server-side mechanisms with Apr. Apr is a high-performance library that is used in HTTP Server 2.x. There are many uses for APR, including advanced IO features (such as SENDFILE,EPOLL,OPENSSL), OS-level mechanisms (random number generation, System state viewing, and so on), and local process IPC mechanisms (shared memory, pipeline, UNIX-based socket programming).
These features enable Tomcat to become a more generic webserver, with better integration with native native resources, and the use of the Java language to become a more mature and reliable webserver platform.
Installation
APR requires the following three native components to be installed:
- Apr Library
- Package tomcat-native for Apr (libtcnative)
- OpenSSL Library
Windows
The binary library for Windows is tcnative-1, which is compiled directly as a. dll file that contains OpenSSL and Apr. You can download from here to the 32-bit and amdx86-64-bit versions.
(a DLL contains all)
In some security scenarios, it is recommended that separate openssl,apr,libtcnative-1 be used and updated according to the appropriate version.
The location of the Windows OpenSSL library is official OpenSSL website.
Linux
Most Linux distributions come with Apr and OpenSSL. The Jni wrapper (libtcnative, which is actually tomcat-native) also needs to be compiled.
Requirements:
- APR 1.2+ Development Headers (Libapr1-dev package)
- OpenSSL 1.0.2+ Development Headers (Libssl-dev package)
- JNI headers from Java compatible JDK 1.4+
- GNU development Environment (GCC, make)
Tomcat-native source code in Tomcat's binary package, in the bin/tomcat-native.tar.gz
archive. Environment variables need to be installed (from the folder containing the Configure script):
./configure && make && make install
APR components
Once the library is installed correctly and can be provided to Java for use (if it fails, the library's path will be prompted), Tomcat's connector will automatically use Apr. Configuring the APR connector is as simple as configuring other connectors, with only a few property configurations.
When APR is started, the following features are added to Tomcat:
- Security SessionID provided at the operating system level
- OS-level memory management, CPU utilization, can be monitored in Tomcat's status servlet
APR Lifecycle Listener Configuration
See the listener configuration.
APR Connectors Configurationhttp/https
For HTTP configuration, see the HTTP connector configuration documentation.
For HTTPS configuration, see the HTTPS connector configuration documentation.
An example SSL Connector declaration is:
<Connector port="443" maxHttpHeaderSize="8192" maxThreads="150" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" SSLEnabled="true" SSLCertificateFile="${catalina.base}/conf/localhost.crt" SSLCertificateKeyFile="${catalina.base}/conf/localhost.key" />
AJP
For AJP configuration, see the AJP connector configuration documentation.
Source: http://tomcat.apache.org/tomcat-8.5-doc/apr.html
From for notes (Wiz)
23.apr/native