GC Tools
GC Tools
- There are multiple ways to enable the GC log: specifying either of the flags -verbose:gc
or -XX:+PrintGC will create a simple GC log (the flags are aliases for each other, and by
default the log is disabled). - The -XX:+PrintGCDetails flag will create a log with much more information. This flag is recommended (it is also false by default); it is often too difficult to diagnose what is happening with GC using only the simple log
- In conjunctionwith the detailed log, it is recommended to include -XX:+PrintGCTimeStamps or
-XX:+PrintGCDateStamps, so that the time between GC operations can be determined. The difference in those two arguments is that the timestamps are relative to 0 (based on when the JVM starts), while the date stamps are an actual date string. That makes the date stamps ever-so-slightly less efficient as the dates are formatted, though it is an infrequent enough operation that its effect is unlikely to be noticed. - The GC log is written to standard output, though that location can be changed with the
-Xloggc:filename flag. Using -Xloggc automatically enables the simple GC log unless
PrintGCDetails has also been enabled. The amount of data that is kept in the GC log
can be limited using log rotation; this is quite useful for a long-running server that
might otherwise fill up its disk with logs over several months. Logfile rotation is
controlled with these flags: -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=N
-XX:GCLogFileSize=N. By default, UseGCLogFileRotation is disabled. When that flag
is enabled, the default number of files is 0 (meaning unlimited), and the default logfile
size is 0 (meaning unlimited). Hence, values must be specified for all these options in
order for log rotation to work as expected. Note that a logfile size will be rounded up to
8 KB for values less than that. - For a scriptable solution, jstat is the tool of choice. jstat provides nine options to
print different information about the heap; jstat -options will provide the full list.
One useful option is -gcutil, which displays the time spent in GC as well as the percentage
of each GC area that is currently filled. Other options to jstat will display the
GC sizes in terms of KB. - Remember that jstat takes an optional argument—the number of milliseconds to repeat
the command—so it can monitor over time the effect of GC in an application. Here
is some sample output repeated every second: jstat -gcutil process_id 1000
Summary
- GC logs are the key piece of data required to diagnose GC issues;
they should be collected routinely (even on production
servers). - A better GC logfile is obtained with the PrintGCDetails flag.
- Programs to parse and understand GC logs are readily available;
they are quite helpful in summarizing the data in the GC
log. - jstat can provide good visibility into GC for a live program.
GC Tools的更多相关文章
- 【转】gc日志分析工具
性能测试排查定位问题,分析调优过程中,会遇到要分析gc日志,人肉分析gc日志有时比较困难,相关图形化或命令行工具可以有效地帮助辅助分析. Gc日志参数 通过在tomcat启动脚本中添加相关参数生成gc ...
- Spark的Straggler深入学习(1):如何在本地图形监控远程Spark的GC情况——使用java自带的jvisualvm
一.本文的目的 Straggler是目前研究的热点,Spark中也存在Straggler的问题.GC问题是总所周知的导致Straggler的重要因素之一,为了了解GC导致的Straggle ...
- GC之七--gc日志分析工具
性能测试排查定位问题,分析调优过程中,会遇到要分析gc日志,人肉分析gc日志有时比较困难,相关图形化或命令行工具可以有效地帮助辅助分析. Gc日志参数 通过在tomcat启动脚本中添加相关参数生成gc ...
- Android 内存分析工具 - LogCat GC
一.GC_Reason 触发垃圾回收的回收的集中原因: 类型 描述 GC_CONCURRENT 内存使用将满时,并发的进行垃圾回收. GC_FOR_MALLOC 当内存已满应用尝试分配内存时会出触发垃 ...
- Java GC系列(4):垃圾回收监视和分析
本文由 ImportNew - lomoxy 翻译自 javapapers. 目录 垃圾回收介绍 垃圾回收是如何工作的? 垃圾回收的类别 垃圾回收监视和分析 在这个Java GC系列教程中,让我们学习 ...
- Java 8 VM GC Tunning Guide Charter 7-8-b
第七章 并发gc Java 8提供两种并发gc,CMS和G1 Concurrent Mark Sweep (CMS) Collector This collector is for applicati ...
- [译]GC专家系列2:Java 垃圾回收的监控
原文链接:http://www.cubrid.org/blog/dev-platform/how-to-monitor-java-garbage-collection/ 这是"成为GC专家系 ...
- Java GC专家系列2:Java 垃圾回收的监控
这是”成为GC专家系列”文章的第二篇.在第一篇理解Java垃圾回收中我们学习了几种不同的GC算法的处理过程,GC的工作方式,新生代与老年代的区别.到目前为止,你应该已经了解了JDK 7中的5种GC类型 ...
- troubleshooting tools in JDK 7--转载
This chapter describes in detail the troubleshooting tools that are available in JDK 7. In addition, ...
随机推荐
- Java中string.equalsIgnoreCase("0")与"0".equalsIgnoreCase(string)的区别:
string.equalsIgnoreCase("0"):如果string为null,会抛出java.lang.NullPointerException异常. "0&qu ...
- 微信小程序(二)登录授权实现
相对于上一节,这一节主要是动态获取数据,主要是对登陆信息的接收,以及页面获取授权按钮的相对相应(未授权时,显示,授权后不显示) 关键在于状态值的判断,以及对页面的不同响应(m-->v) wxml ...
- 安卓开发:UI组件-图片控件ImageView(使用Glide)和ScrollView
2.7ImageView 2.7.1插入本地图片 一个图片控件,可以用来显示本地和网络图片. 在首页添加按钮ImageView,指向新页面(步骤与前同,不再详写). activity_image_vi ...
- Android 启动APP时黑屏白屏的解决方案
在开发中,我们在启动app的时候,屏幕会出现一段时间的白屏或者黑屏,不同设备时间长短不同.很影响用户体验. 首先分析一下,产生这个现象的原因,当我们在启动一个应用时,系统会去检查是否已经存在这样一个进 ...
- 前后端交互实现(nginx,json,以及datatable的问题相关)
1.同源问题解决 首先,在同一个域下搭建网络域名访问,需要nginx软件,下载之后修改部分配置 然后再终端下cmd nginx.exe命令,或者打开nginx.exe文件,会运行nginx一闪而过, ...
- c/c++ 重载运算符 标准库function的用法
重载运算符 标准库function的用法 问题:int(int, int)算不算一种比较通用的类型?? 比如函数: int add(int a, int b); 比如lambda:auto mod = ...
- Cs231n-assignment 1作业笔记
KNN assignment1 KNN讲解参见: https://blog.csdn.net/u014485485/article/details/79433514?utm_source=blogxg ...
- 网络威胁实时地图(CyberThread Real-time Map)
今天跟大家分享一下网络威胁实时地图(CyberThread Real-time Map),从地图上可以看出目前网络威胁情况数据. 点击打开网络威胁实时地图 可以点击demo on/off来看演示.可以 ...
- 英语口语练习系列-C01-好棒
古诗 来自百度 It's cool. It is neat. It's righteous! It's righteous! 酷毙了! righteous是 cool 的高级了 如果一件事让你无法用 ...
- for循环和foreach循环遍历集合的效率比较
先上代码 package com.test; import java.util.ArrayList; import java.util.LinkedList; import java.util.Lis ...