JVM参数优化实例
JDK
版本
jvm
参数:
-Xms24g
-Xmx24g
-Xmn12g
-XX:SurvivorRatio=8
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
-XX:+UseConcMarkSweepGC
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=./heapdump.hprof
-XX:+UseGCOverheadLimit
-Xloggc:gc.log
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=8
-XX:GCLogFileSize=512k
-XX:+PrintHeapAtGC
运行15min时
jvm
情况
总内存
元数据区
老年代
年轻代
垃圾回收次数
垃圾回收时长
每个物理CPU
的核心数
优化后
-Xms24g
-Xmx24g
-Xmn18g
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=256m
-XX:SurvivorRatio=8
-XX:-UseBiasedLocking
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:ConcGCThreads=8
-XX:ParallelGCThreads=8
-XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=92
-XX:-OmitStackTraceInFastThrow
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=./heapdump.hprof
-XX:+UseGCOverheadLimit
-Xloggc:gc.log
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=8
-XX:GCLogFileSize=512k
-XX:+PrintHeapAtGC
运行4个小时
运行10小时
年轻代扩大至22g
-Xms24g
-Xmx24g
-Xmn22g
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=256m
-XX:SurvivorRatio=8
-XX:-UseBiasedLocking
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:ConcGCThreads=8
-XX:ParallelGCThreads=8
-XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=92
-XX:-OmitStackTraceInFastThrow
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=./heapdump.hprof
-XX:+UseGCOverheadLimit
-Xloggc:gc.log
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=8
-XX:GCLogFileSize=512k
-XX:+PrintHeapAtGC
总览
——————————————————————————————分割线——————————————————————————————
运行了一天的情况