NIO
[root@localhost ~]# vim /usr/local/tomcat9/conf/server.xml
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="50"
noCompressionUserAgents="gozilla,traviata"
compressableMimeType="test/html,text/xml.text/javascript,text/css,text/plain" />
[root@localhost ~]# /usr/local/tomcat9/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat9/bin/startup.sh
[root@localhost ~]# tail -f /usr/local/tomcat9/logs/catalina.out
23-Sep-2019 09:06:46.472 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"]
23-Sep-2019 09:06:46.517 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["ajp-nio-8009"]
23-Sep-2019 09:06:46.523 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in [1,864] milliseconds
APR
[root@localhost ~]# yum -y install apr apr-devel
[root@localhost ~]# cp /usr/local/tomcat9/bin/tomcat-native.tar.gz ./
[root@localhost ~]# tar fx tomcat-native.tar.gz
[root@localhost ~]# cd tomcat-native-1.2.19-src/native/
[root@localhost native]# ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/local/java/ && make && make install
[root@localhost native]# vim /usr/local/tomcat9/bin/catalina.sh
CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib"
[root@localhost native]# vim /usr/local/tomcat9/conf/server.xml
<Connector port="8080" protocol="org.apache.coyote.http11.Http11AprProtocol"
[root@localhost native]# /usr/local/tomcat9/bin/shutdown.sh
[root@localhost native]# /usr/local/tomcat9/bin/startup.sh
[root@localhost ~]# tail -f /usr/local/tomcat9/logs/catalina.out
23-Sep-2019 09:20:57.087 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-apr-8080"]
23-Sep-2019 09:20:57.113 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["ajp-nio-8009"]
23-Sep-2019 09:20:57.123 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in [2,422] milliseconds