公司的CMS参数
java -jar -Dcsp.sentinel.log.dir=/home/ymmapp/ymmapplogs/sentinel -javaagent:/data/gravity/gravity-agent.jar=appName=trade-om-app, baseUrl=http://gravity-api.amh-group.com,appType=jar -Xms8192m -Xmx8192m -Xmn3072m -XX:MetaspaceSize=300m -XX:MaxMetaspaceSize=600m -XX:+UseConcMarkSweepGC -XX:MaxTenuringThreshold=15 -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCApplicationStoppedTime -XX:+SafepointTimeout -XX:SafepointTimeoutDelay=500 -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy -XX:+CMSScavengeBeforeRemark -XX:HeapDumpPath=/data/applogs/system/error.dump -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses -XX:CMSInitiatingOccupancyFraction=70 -XX:+PrintGCDateStamps -XX:+UseCMSInitiatingOccupancyOnly -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+UseParNewGC -XX:+PrintGCDetails -Xloggc:/data/applogs/system/gc_202007061528.log -Dspring.cloud.bootstrap.location=/data/appdatas/eureka/bootstrap.properties -Dspring.profiles.active=prod -Dserver.port=20298 -Dhealthcheck.flow.enter.control=true ./trade-om-app.jar >> /data/applogs/system/trade-om-app.log 2>&1
1 堆空间8G 年轻代 3G 元空间300M 最大600M
2 -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly 老年代使用达到70%就进行CMS gc
3 -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses 发生老年代GC 卸载不需要的Class文件