Tomcat server.xml优化

2017-11-13  本文已影响85人  寀菇凉的小蜜蜂

1. 使用线程池处理HTTP请求


<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="1000" minSpareThreads="50" maxIdleTime="600000" />

2. Connector(一旦使用了线程池,则其它的线程属性,比如 maxThreads等将被忽略 )


<Connector port="8080" executor="tomcatThreadPool"
           protocol="org.apache.coyote.http11.Http11NioProtocol" acceptCount="300"
           enableLookups="false" disableUploadTimeout="false" connectionTimeout="20000" 
           compression="on" compressionMinSize="20480" 
           noCompressionUserAgents="gozilla,traviata" 
           compressableMimeType="application/json,text/html,text/xml,application/javascript,text/css,text/plain" 
           redirectPort="8443" URIEncoding="UTF-8" />

3. 为了提高安全性,一般情况下屏蔽 AJP


<!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->

上一篇下一篇

猜你喜欢

热点阅读