首页  

jvm设置滚动记录GC日志     所属分类 java 浏览量 1492
-XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-Xloggc:/home/dyyx/soft/benchmark7020/gclogs/gc.log
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 -XX:GCLogFileSize=10M

开启滚动日志 ,必须设置 Xloggc
滚动日志文件的大小,必须大于8k

滚动日志 命名  $filename.0   ...  $filename.N

gc.log.0.current


gc.log.0
gc.log.1.current

-XX:+PrintGCTimeStamps
输出GC时间戳(以基准时间的形式)




GC日志

560.430: [GC (Allocation Failure) [PSYoungGen: 677120K->112864K(1052672K)] 2604056K->2039800K(3849216K), 0.1925963 secs] [Times: user=3.33 sys=1.03, real=0.19 secs] 
569.990: [GC (Allocation Failure) [PSYoungGen: 796896K->137376K(1029120K)] 2723832K->2064312K(3825664K), 0.1898895 secs] [Times: user=3.14 sys=1.18, real=0.19 secs] 
579.759: [GC (Allocation Failure) [PSYoungGen: 821408K->162368K(1068032K)] 2748344K->2089304K(3864576K), 0.3197191 secs] [Times: user=6.00 sys=1.28, real=0.32 secs] 
590.158: [GC (Allocation Failure) [PSYoungGen: 898112K->188736K(924672K)] 2825048K->2115672K(3721216K), 0.2526564 secs] [Times: user=4.67 sys=1.09, real=0.25 secs] 
600.551: [GC (Allocation Failure) [PSYoungGen: 924480K->215360K(1036800K)] 2851416K->2142304K(3833344K), 0.2703048 secs] [Times: user=5.09 sys=1.07, real=0.27 secs] 



查看 jvm 实际运行参数

jcmd 303757 VM.flags
303757:
-XX:CICompilerCount=15 -XX:GCLogFileSize=10485760 -XX:InitialHeapSize=4294967296 
-XX:MaxHeapSize=4294967296 -XX:MaxNewSize=1431306240 
-XX:MinHeapDeltaBytes=524288 -XX:NewSize=1431306240 
-XX:NumberOfGCLogFiles=3 -XX:OldSize=2863661056 -XX:+PrintGC -XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops 
-XX:+UseFastUnorderedTimeStamps -XX:+UseGCLogFileRotation -XX:+UseParallelGC

打印全部参数
 jcmd 303757 VM.flags -all

上一篇     下一篇
简单的清理脚本实战

prometheus配置

linux下找出占用指定端口的进程

基于数据库的分布式锁设计

prometheus集成grafana实现可视化

g1 GC 要点