JVM调优参数设置以及gc日志查看
生产环境使用的JVM配置:
-XX:+CMSClassUnloadingEnabled
如果你启用了CMSClassUnloadingEnabled ,垃圾回收会清理持久代,移除不再使用的classes。这个参数只有在 UseConcMarkSweepGC 也启用的情况下才有用。
-XX:CMSInitiatingOccupancyFraction=percent
设置一个年老代的占比,达到多少会触发CMS回收。默认是-1,任何一个负值的设定都表示了用-XX:CMSTriggerRatio来做真实的初始化值。
-XX:CMSMaxAbortablePrecleanTime=5000
只要到了5S,不管发没发生Minor GC,有没有到CMSScheduleRemardEdenPenetration都会中止此阶段,进入remark。
-XX:+ExplicitGCInvokesConcurrent
支持通过System.gc()来做并发的GC。默认是不支持的。该参数一定要和-XX:+UseConcMarkSweepGC一起使用。
-XX:InitialHeapSize=1073741824
设置初始堆内存大小,需要设置为0或者1024的倍数,设置为0说明初始堆大小等于年轻代加年老代的大小。
-XX:MaxDirectMemorySize=size
为NIO的direct-buffer分配时指定最大的内存大小。默认是0,意思是JVM自动选择direct-buffer的大小。
-XX:MaxHeapSize=1073741824
最大堆内存大小
-XX:MaxNewSize=268435456
新生代占整个堆内存的最大值
-XX:NewSize=268435456
新生代预估堆内存占用的默认值
-XX:OldPLABSize=16
Size of old gen promotion LAB's (in HeapWords)
-XX:+PrintGC
Print message at garbage collection
-XX:+PrintGCDateStamps
Print date stamps at garbage collection
-XX:+PrintGCDetails
Print more details at garbage collection
XX:+PrintGCTimeStamps
Print timestamps at garbage collection
-XX:SurvivorRatio=8
Ratio of eden/survivor space size
+UseCMSCompactAtFullCollection
Use Mark-Sweep-Compact algorithm at full collections
-XX:+UseCMSInitiatingOccupancyOnly
Only use occupancy as a criterion for starting a CMS collection
-XX:+UseCompressedOops
Use 32-bit class pointers in 64-bit VM. lp64_product means flag is always constant in 32 bit VM
XX:+UseConcMarkSweepGC
Use Concurrent Mark-Sweep GC in the old generation
-XX:+UseParNewGC
Use parallel threads in the new generation
日志查看:

浙公网安备 33010602011771号