Tomcat 7优化
01 | set JAVA_OPTS= |
02 | -server |
03 | -Xms1000M |
04 | -Xmx1000M #-Xms与-Xmx设成一样的值,避免JVM因为频繁的GC导致性能大起大落 |
05 | -Xss512k |
06 | -XX:+AggressiveOpts |
07 | -XX:+UseBiasedLocking |
08 | -XX:PermSize=64M |
09 | -XX:MaxPermSize=300M |
10 | -XX:+DisableExplicitGC |
11 | -XX:MaxTenuringThreshold=31 |
12 | -XX:+UseConcMarkSweepGC |
13 | -XX:+UseParNewGC |
14 | -XX:+CMSParallelRemarkEnabled |
15 | -XX:+UseCMSCompactAtFullCollection |
16 | -XX:LargePageSizeInBytes=128m |
17 | -XX:+UseFastAccessorMethods |
18 | -XX:+UseCMSInitiatingOccupancyOnly |
| -Djava.awt.headless= true |
修改conf/server.xml文件,把原来
1 | < Connector port = "8080" protocol = "HTTP/1.1" /> |
改成下面的内容
01 | < Connector port = "8080" protocol = "HTTP/1.1" |
02 | URIEncoding = "UTF-8" |
03 | minSpareThreads = "25" |
04 | maxSpareThreads = "75" |
05 | enableLookups = "false" |
06 | disableUploadTimeout = "true" |
07 | connectionTimeout = "20000" |
08 | acceptCount = "300" |
09 | maxThreads = "300" |
10 | maxProcessors = "1000" |
11 | minProcessors = "5" |
12 | useURIValidationHack = "false" |
13 | compression = "on" |
14 | compressionMinSize = "2048" |
15 | compressableMimeType = "text/html,text/xml,text/javascript,text/css,text/plain" |
16 | redirectPort = "8443" /> |