tomcat默认使用BIO,未启用tomcat native。
tomcat native通过jni使用操作系统的高性能IO库,提高并发能力。
参考资料:
1. 安装依赖的软件包
yum install apr apr-devel
yum install apr-util apr-util-devel
yum install java-1.7.0-openjdk-devel
2. 编译,安装
tar xzf /opt/apache-tomcat-7.0.56/bin/tomcat-native.tar.gz
./configure --with-apr=/usr --with-java-home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64 --prefix=/opt/apache-tomcat-7.0.56
make
make install
3. 配置tomcat
编写/opt/apache-tomcat-7.0.56/bin/startup_native.sh
加入库路径
LD_LIBRARY_PATH=/opt/apache-tomcat-7.0.56/lib
export LD_LIBRARY_PATH
修改server.xml,禁用SSL
/opt/apache-tomcat-7.0.56/conf/server.xml
4. 检查是否正确安装
查看tomcat启动日志catalina.out
正确安装时出现如下日志
Feb 05, 2015 9:12:05 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.31 using APR version 1.3.9.
Feb 05, 2015 9:12:05 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
未正确安装时出现如下日志
Feb 05, 2015 9:01:29 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
阅读(1020) | 评论(0) | 转发(0) |