垃圾收集器G1推荐配置
-XX:OnOutOfMemoryError=kill -9 %p
-XX:OnError=jstack -F %p >ErrorDump.log
-Xms4g
-Xmx8g
-server
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/home/lcs/m.hprof
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:G1HeapRegionSize=16m
-XX:+ParallelRefProcEnabled
-XX:ParallelGCThreads=20
-XX:ConcGCThreads=8
-Djava.net.preferIPv4Stack=true
说明:
-XX:+ParallelRefProcEnabled -XX:ParallelGCThreads=20(逻辑核心数的5/8) -XX:ConcGCThreads=8(逻辑核心数的1/4)
命令:
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
参考:https://www.cnblogs.com/emanlee/p/3587571.html
参考博文:
http://www.cnblogs.com/ASPNET2008/p/6496481.html
http://itindex.net/detail/50104-jvm-%E6%97%A5%E5%BF%97-%E7%90%86%E8%A7%A3
http://www.importnew.com/15311.html
jvm参数详细说明:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html