tomcat 内存参数优化示例
CMS垃圾回收算法
CATALINA_OPTS="$CATALINA_OPTS -Xms1024M -Xmx2048M -XX:PermSize=384M -XX:MaxPermSize=512M" CATALINA_OPTS="$CATALINA_OPTS -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxGCPauseMillis=300" CATALINA_OPTS="$CATALINA_OPTS -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled" CATALINA_OPTS="$CATALINA_OPTS -XX:-DisableExplicitGC" CATALINA_OPTS="$CATALINA_OPTS -XX:ParallelGCThreads=2" CATALINA_OPTS="$CATALINA_OPTS -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails" CATALINA_OPTS="$CATALINA_OPTS -Xloggc:`dirname "$0"`/../logs/gc.log" CATALINA_OPTS="$CATALINA_OPTS -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=15 -XX:GCLogFileSize=8M" CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=18480 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" CATALINA_OPTS="$CATALINA_OPTS -XX:+UnlockCommercialFeatures -XX:+FlightRecorder" CATALINA_OPTS="$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdump"
G1垃圾回收算法
CATALINA_OPTS="$CATALINA_OPTS -Xms10g -Xmx10g -XX:PermSize=1024M -XX:MaxPermSize=2048M " CATALINA_OPTS="$CATALINA_OPTS -XX:+DisableExplicitGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintGCTimeStamps -Xloggc:logs/gc.log" JAVA_OPTS="$JAVA_OPTS -server" CATALINA_OPTS="$CATALINA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=300" CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=18480 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
定义tomcat发布目录
[smmprd@(LIVE)smm-app10 localhost]$ pwd /data/server/tomcats/tomcat7_8480_storeService/conf/Catalina/localhost [smmprd@(LIVE)smm-app10 localhost]$ cat storeService.xml <Context path="/storeService" docBase="/data/server/apps/storeService" privileged="true" antiResourceLocking="false" antiJARLocking="false"> </Context>