jvm 配置

时间:2022-11-24 10:38:12

# 内存参数
MEMORY_OPTS="-Xms2048m -Xmx2048m -Xmn1024m -XX:MaxDirectMemorySize=2048m -XX:PermSize=256m -XX:MaxPermSize=512m"
# 性能参数
# -XX:+PerfDisableSharedMem: 解决: JVM statistics cause garbage collection pauses, 导致: jps, jstat不可用
PERFORMANCE_OPTS="-XX:-UseBiasedLocking -XX:-UseCounterDecay -XX:+AlwaysPreTouch -XX:AutoBoxCacheMax=20000 -XX:ReservedCodeCacheSize=240m"
# GC CMS参数
CMS_GC_OPTS="-XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -XX:MaxTenuringThreshold=6 -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled"
# GC 日志参数
GC_OPTS="-Xloggc:/dev/shm/cgi-gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDateStamps -XX:+PrintGCDetails"
# 异常参数
ERROR_OPTS="-XX:-OmitStackTraceInFastThrow -XX:ErrorFile=${LOG_PATH}/hs_err_%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOG_PATH}/"
# JMX
JMX_PORT="18888"
JMX_OPTS="-Dcom.sun.management.jmxremote.port=${JMX_PORT} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1"