3.调整线程池
protocol=”org.apache.coyote.http11.Http11NioProtocol”
connectionTimeout=”20000”
URIEncoding=”UTF-8”
useBodyEncodingForURI=”true”
enableLookups=”false”
redirectPort=”8443” />
maxThreads=”1024”
minSpareThreads=”512”
prestartminSpareThreads=”true” />
2.JVM参数调整
根据服务器内存而定,大于8G使用G1收集器,小于8g使用parNew+CMS收集器
方案一(6G<系统内存<=8G):
JAVA_OPTS=”-Xmx4000M -Xms4000M -Xmn600M -XX:PermSize=500M -XX:MaxPermSize=500M -Xss256K \
-XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC \
-XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 \
-XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M -XX:+UseFastAccessorMethods \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 \
-XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:/var/log/tomcatgc.log”
1.使用非阻塞的NIO连接器tomcat7需要如下配置:
connectionTimeout=”20000”
URIEncoding=”UTF-8”
useBodyEncodingForURI=”true”
maxThreads=”1024”
minThreads=”768”
minSpareThreads=”64”
enableLookups=”false”
redirectPort=”8443” />
tomcat8默认就使用NIO,并且URIEncoding默认utf-8
