Label:
TOMCAT7
JVM
PerformanceShare to:Source: http://www.iteye.com
This optimization is for Linux x86_x64 environments
1. Tomcat optimization is actually optimized for Server.xml (account thread pool, adjust HTTP connector parameters)
Search for "<executor name=" Tomcatthreadpool "", open and adjust to
<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-"
maxthreads= "Maxidletime=" 60000 "
Minsparethreads= "/>"
Search for "port=" 8080 "", adjusted to
<connector executor= "Tomcatthreadpool"Port=" 8080 "//Open thread pool
Protocol= "ORG.APACHE.COYOTE.HTTP11.Http11aprprotocol"//Open APR protocol, need to install APR support
Maxhttpheadersize= "8192" maxthreads= "processorcache=" "acceptcount=" 1000 "
minsparethreads= "100"
Acceptorthreadcount= "8" uriencoding= "UTF-8"
enablelookups= "false" redirectport= "8443"//Turn off reverse query
connectiontimeout= "120000" keepalivetimeout= "120000"
Maxkeepaliverequests= "65535" disableuploadtimeout= "true"
Compression= "On" compressionminsize= "4096"//Turn on static file compression
nocompressionuseragents= "Gozilla, Traviata"//Turn on static file compression
Compressablemimetype= "Text/html,text/xml,text/javascript,text/css,text/plain,application/json,application/x-javascript"//Turn on static file compression
/>
2. Optimizing the JVM for catalina.sh
Open the Tomcat path \bin\ catalina.sh, add at the top, red part please adjust according to the actual situation
Java_opts= "-server-showversion-xms12g-xmx12g-xx:permsize=256m-xx:maxpermsize=256m "
java_opts= "$JAVA _opts-d64-xx:cicompilercount=8-xx:+usecompressedoops"
java_opts= "$JAVA _opts-xx:survivorratio=4-xx:targetsurvivorratio=90"
java_opts= "$JAVA _opts-xx:reservedcodecachesize=256m-xx:-useadaptivesizepolicy"
java_opts= "$JAVA _opts-duser.timezone=asia/shanghai-xx:-dontcompilehugemethods"
java_opts= "$JAVA _opts-xss256k-xx:+aggressiveopts-xx:+usebiasedlocking"
java_opts= "$JAVA _opts-xx:maxtenuringthreshold=31-xx:+cmsparallelremarkenabled"
java_opts= "$JAVA _opts-xx:+usecmscompactatfullcollection-xx:largepagesizeinbytes=256m-xx:+ Usefastaccessormethods "
java_opts= "$JAVA _opts-xx:+usecmsinitiatingoccupancyonly-djava.awt.headless=true"
java_opts= "$JAVA _opts-xx:+usegcoverheadlimit-xx:allocateprefetchdistance=256-xx:allocateprefetchstyle=1"
java_opts= "$JAVA _opts-xx:+useconcmarksweepgc-xx:+useparnewgc-xx:maxgcpausemillis=200"
Note
1.-xms=-xmx= server memory *70%, such as deploying Tomcat,jboss-xms=-xmx= server memory on the same server *80%*1/4
2. Added parameter suggestions to understand what it means, you can refer to the JVM parameter list
TOMCAT7 Tuning and JVM performance optimization for Linux environments