tomcat的运行模式有3种.修改他们的运行模式.3种模式的运行是否成功,可以看他的启动控制台,或者启动日志.或者登录他们的默认页面http://localhost:8080/查看其中的服务器状态。
1)bio
默认的模式,性能非常低下,没有经过任何优化处理和支持.
2)nio
利用Java的异步io护理技术,no blocking IO技术.
想运行在该模式下,直接修改server.xml里的Connector节点,修改protocol为
<Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" URIEncoding="UTF-8" useBodyEncodingForURI="true" enableLookups="false" redirectPort="8443" />
启动后,就可以生效。
3)apr
安装起来最困难,但是从操作系统级别来解决异步的IO问题,大幅度的提高性能.
必须要安装apr和native,直接启动就支持apr。
下面的修改纯属多余,仅供大家扩充知识,但仍然需要安装apr和native
如nio修改模式,修改protocol为org.apache.coyote.http11.Http11AprProtocol
org.apache.coyote.http11.Http11Protocol - blocking Java connector
org.apache.coyote.http11.Http11NioProtocol - non blocking Java connector
org.apache.coyote.http11.Http11AprProtocol - the APR/native connector.
Below is a small chart that shows how the connectors differ.
tomcat7 官方文档地址:http://tomcat.apache.org/tomcat-7.0-doc/config/http.html
该地址非常详细,包括config的一些参数配置,没事应该多多翻阅
其他:
http://www.tuicool.com/articles/nEJBva
http://blog.csdn.net/trips/article/details/50838681(压测对比)
http://www.cnblogs.com/nb-blog/p/5278933.html
http://blog.csdn.net/wanglei_storage/article/details/50225779(压测对比)
http://www.360doc.com/content/15/0603/14/20671606_475357473.shtml
http://blog.csdn.net/lifuxiangcaohui/article/details/33357987