cms remark 标记长?

最近和群友聊天 发现 java 服务上线后发现 cms 重新标记很长。整理结果如下:

首先启动参数

 

-Xmx4096m -Xms4096m -Xmn1536m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=8 -XX:MaxTenuringThreshold=9 -XX:+ExplicitGCInvokesConcurrent -XX:+CMSParallelRemarkEnabled -XX:+CMSScavengeBeforeRemark -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UseCMSCompactAtFullCollection -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./logs/dump.log -XX:+PrintGCDateStamps

通过jstat命令查看啦,发现发生4次full gc 
cms remark 标记长?_第1张图片

查看GC 日志,发现cms-remak时间长

cms remark 标记长?_第2张图片

查阅相关资料后设置启动参数如下 ,导致cms remak时间明显缩短

 

-XX:MaxDirectMemorySize=1G -XX:+ParallelRefProcEnabled -XX:ConcGCThreads=3 -XX:CMSFullGCsBeforeCompaction=5 -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-OmitStackTraceInFastThrow -XX:+ExplicitGCInvokesConcurrent -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses -XX:StringTableSize=300065

相比之前启动参数 主要增加了 一下三个参数

 

-XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0   -XX:CMSFullGCsBeforeCompaction=5

cms remark 标记长?_第3张图片

然后cms垃圾回收 remak 明显变小了。

你可能感兴趣的:(jvm)