1、启用线程池及配置
<Executor name="tomcatThreadPool" namePRefix="catalina-exec-" maxThreads="500" minSpareThreads="100" prestartminSpareThreads="true" />
<Connector executor="tomcatThreadPool" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" .../>
2、NIO配置
cd /usr/local/tomcat7/conf
vim server.conf
<Connector executor="tomcatThreadPool" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" .../>
3、APR配置
1)下载并安装APR lib
http://apr.apache.org/download.cgi
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.5.2.tar.gzwget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.gzwget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz
tar xzf apr-1.5.2.tar.gz tar xzf apr-iconv-1.2.1.tar.gz tar xzf apr-util-1.5.4.tar.gz
cd apr-1.5.2vim configure 29605行(避免出现:rm: cannot remove `libtoolT': No such file or directory )把RM='$RM'改为RM='$RM -f'
./configure && make && make installcd ../apr-util-1.5.4./configure --with-apr=/usr/local/apr && make && make installcd ../apr-iconv-1.2.1./configure --with-apr=/usr/local/apr && make && make install2)下载openssl并安装
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz tar xzf openssl-1.0.1e.tar.gz cd openssl-1.0.1e
./config --prefix=/usr/local/openssl-1.0.1e -fPIC && make && make install3)编译安装tomcat-native.tar.gz
cd /usr/local/tomcat7/bin/tar xzf tomcat-native.tar.gzcd tomcat-native-1.1.33-src/jni/native/./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-ssl=/usr/local/openssl-1.0.1e && make && make install4)配置Tomcat
cd /usr/local/tomcat7/conf/vim server.xml
修改 Connector节点中protocal="org.apache.coyote.http11.Http11AprProtocol", 同时将<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" /> 设置成off(如果不配置SSL访问的话)
5)将apr lib路径加入到java.library.path中
vim /usr/local/tomcat7/bin/daemon.sh
在CATALINA_OPTS中增加-Djava.library.path=/usr/local/apr/lib (使用LD_LIBRARY_PATH的方法无效)
重启Tomcat, 可以看到
Feb 08, 2017 1:42:48 PM org.apache.catalina.core.AprLifecycleListener lifecycleEventINFO: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.2.Feb 08, 2017 1:42:48 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
新闻热点
疑难解答