tomcat运维规范
JVM参数优化:
1.配置JAVA目录:
JAVA_HOME="/bankapp/deploy/jdk"
2.开启JMX监控8999端口:
CATALINA_OPTS=“Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=8999
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false”
3.设置JAVA_OPTS变量:
JVM Heap大小推荐以主机系统内存/2,new/old比例1:3。8G内存以上的可配置为系统内存2/3左右,如16G,可配置10~12G。以下为8G的配置样例:
JDK版本 | 默认值 |
jdk6&7 | -Xms4g -Xmx4g -XX:NewRatio=3 -Xss512k -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UsecmsIntiatingOccupancyOnly -XX:cmsInitiatingCccupancyFraction=75 -XX:+PrintGCDetails -XX:+PrinHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/bankapp/deploy/logs/tomcat/heapdump -verbose:gc -Xloggc:/dev/shm/gc`date +%Y%m%d%H%M%S`.log |
JDK8 | -Xms4g -Xmx4g -XX:NewRatio=3 -Xss512k -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UsecmsIntiatingOccupancyOnly -XX:cmsInitiatingCccupancyFraction=75 -XX:+PrintGCDetails -XX:+PrinHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/bankapp/deploy/logs/tomcat/heapdump -verbose:gc -Xloggc:/dev/shm/gc`date +%Y%m%d%H%M%S`.log |