Tomcat优化

最近在阿里云搭建了一个Tomcat,来优化下:

 

1.开启Gzip

默认Tomcat是没有开启的,除非你的工程加了Gzip;

找到Server.xml

<Connector port="80" protocol="HTTP/1.1" executor="tomcatThreadPool"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json" />

 

2.开启ThreadPool

Tomcat自带的线程池,默认这个也是注释的,需要开启,根据服务器性能和业务需要进行优化调整;

<!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>

 

3.加大内存……,硬道理;

 

 

你可能感兴趣的:(tomcat)