安装tomcat native library提升Tomcat的吞吐性能

1、安装APR
http://apr.apache.org下载apr-1.4.2.tar.gz。

tar –xvf apr-1.4.2.tar.gz
./configure --prefix=/{Tomcat根目录}/apr
make
make instal

2、安装APR-UTIL
http://apr.apache.org下载apr-util-1.3.9.tar.gz。

tar –xvf apr-util-1.3.9.tar.gz
./configure --prefix=/{Tomcat根目录}/apr --with-apr=/{Tomcat根目录}/apr
make
make install

3、安装tomcat native library
http://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.1.9/source/ 下载最新的 native

tar zxvf tomcat-native-1.1.9-src.tar.gz
cd /tomcat-native-1.1.9-src/jni/native
./configure --prefix=/{Tomcat根目录}/apr --with-apr=/{Tomcat根目录}/apr –with-java-home={JDK根目录}
make
make install

4、在 %TOMCAT_HOME%/bin/catalina.sh 加入
JAVA_OPTS="$CATALINA_OPTS -Djava.library.path={Tomcat根目录}/apr/lib"(在"Execute The Requested Command"注释行前加入
)


Tomcat配置说明:

%TOMCAT_HOME%/bin/catalina.sh
将 JAVA_OPTS="$CATALINA_OPTS -Djava.library.path={Tomcat根目录}/apr/lib" 改为:
JAVA_OPTS="$CATALINA_OPTS -Djava.library.path={Tomcat根目录}/apr/lib -Djava.awt.headless=true"

%TOMCAT_HOME%/conf/server.xml
在 <Connector port="8080" protocol="HTTP/1.1" 节点上加入以下属性,如果已存在就不再添加
    maxHttpHeaderSize="8192"
    useBodyEncodingForURI="true"
    URIEncoding="UTF-8"
    redirectPort="8443" 
    enableLookups="false" 
    compression="on"  
    compressionMinSize="2048" 
    compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"  
    disableUploadTimeout="true

你可能感兴趣的:(java,jdk,tomcat,command,library,compression)