JVM-GCLOG相关参数整理

gc日志参数建议

-verbose:class 
-XX:+PrintCommandLineFlags 
-XX:+PrintGCDetails 
-XX:+PrintGCDateStamps 
-XX:+PrintClassHistogramBeforeFullGC 
-XX:+PrintClassHistogramAfterFullGC 
-XX:+PrintGCApplicationConcurrentTime 
-XX:+PrintGCApplicationStoppedTime 
-XX:+PrintTenuringDistribution 
-XX:+PrintHeapAtGC 
-Xloggc:/data/files/tmp/foo/gc.log 
-XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=/data/files/tmp/foo
-XX:ErrorFile=/data/files/tmp/foo/hs_err_pid%p.log 

-verbose:class

  • 这个选项打印内容可能有点多,考虑作为可选项
  • Tracing Class Load And Unload

-XX:+PrintCommandLineFlags

  • Print flags specified on command line or set by ergonomics
  • 扩展参数:-XX:+PrintFlagsFinal
    • 这个选项打印内容可能有点多,考虑作为可选项
    • Print all VM flags after argument and ergonomic processing
    表格的每一行包括五列,来表示一个XX参数。第一列表示参数的数据类型,第二列是名称,第四列为值,第五列是参数的类别。第三列”=”表示第四列是参数的默认值,而”:=” 表明了参数被用户或者JVM赋值了。
    

-XX:+PrintGCDetails

  • Print more details at garbage collection
  • 这个打印的内容比-verbose:gc 更详细

-XX:+PrintGCDateStamps

  • Print date stamps at garbage collection

-XX:+PrintClassHistogramBeforeFullGC

  • 这个选项打印内容可能有点多,考虑作为可选项
  • Print a class histogram before any major stop-world GC

-XX:+PrintClassHistogramAfterFullGC

  • 这个选项打印内容可能有点多,考虑作为可选项
  • Print a class histogram after any major stop-world GC

-XX:+PrintGCApplicationConcurrentTime

  • Print the time the application has been running
  • 打印每次垃圾回收前,程序未中断的执行时间。

-XX:+PrintGCApplicationStoppedTime

  • Print the time the application has been stopped
  • 打印垃圾回收期间程序暂停的时间。

-XX:+PrintTenuringDistribution

  • Print tenuring age information
  • 指定JVM 在每次新生代GC时,输出幸存区中对象的年龄分布。
  • 可以用来收集年龄分布数据,为-XX:MaxTenuringThreshold参数的调优提供参考。

-XX:+PrintHeapAtGC

  • Print heap layout before and after each GC
  • 在进行GC的前后打印出堆的信息

-Xloggc:/home/app/foo/gc.log

  • GC Log File Path

-XX:+HeapDumpOnOutOfMemoryError

  • Dump heap to file when java.lang.OutOfMemoryError is thrown

-XX:HeapDumpPath=/home/app/foo

  • When HeapDumpOnOutOfMemoryError is on, the path (filename or directory) of the dump file (defaults to java_pid<pid>.hprof in the working directory)

-XX:ErrorFile=/home/app/foo/hs_err_pid%p.log

  • If an error occurs, save the error data to this file [default: ./hs_err_pid%p.log] (%p replaced with pid)

转载于:https://my.oschina.net/sunxinhe/blog/1839061

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值