jvm g1gc回收器

G1垃圾回收器
java大内存进程使用G1更有优越性,没有survivor的浪费和fgc易导致cpu飙高,G1的大部分参数不需要设置,jvm会自动动态优化。


-XX:+UseG1GC -Xss10m -XX:MaxGCPauseMillis=800 -XX:ParallelGCThreads=15 -XX:ConcGCThreads=4
使用G1时不要配置-Xmn和-XX:NewRatio。(参照http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html)

Young Generation Size: Avoid explicitly setting young generation size with the -Xmn option or any or other related option such as -XX:NewRatio. Fixing the size of the young generation overrides the target pause-time goal.

-Xss10m线程最大栈设置,如果出现过stackoverflow,需要调大此参数,我们es的线程数不多可以适当调大(pstree -p [pid] | wc -l);堆大小不变该参数调大则能创建的线程数将减少。
-XX:MaxGCPauseMillis默认200,后台任务不追求最快响应时间,追求最大吞吐量需适当调大
-XX:ParallelGCThreads设为cpu的逻辑核数,如果逻辑核数超过8则设为5/8,我们机器是24个逻辑核,所以设为15
-XX:ConcGCThreads设为-XX:ParallelGCThreads的1/4

原文地址:https://www.cnblogs.com/cheyunhua/p/14679975.html