背景
很久之前的事情了,在很久很久……
一般在做性能测试的时候为最小限度影响性能,基本会不开gc日志,但出现问题,有要查看相关信息,麻勒个烦啊
有没有两全其美的办法?
有
废话略过,往下看
jinfo
jinfo(Java Configuration Information),主要用于查看正在运行的Java进程(或核心文件、远程调试服务器)的Java配置信息
用法
[root@localhost config]# jinfo
Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
(to connect to a core file)
jinfo [option] [server_id@]
(to connect to remote debug server)
where is one of:
-flag to print the value of the named VM flag
-flag [+|-] to enable or disable the named VM flag
-flag = to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
to print both of the above
-h | -help to print this help message
重点看-flag选项(圈起来要考试~)
在使用-flag选项时,jinfo实用程序可以动态调整特定Java进程的特定Java VM标志的值。这类选项的列表是有限的,但在一些场合仍然有用。JVM上的这些标志的完整列表可以通过以下命令进行检查
[root@localhost config]# java -XX:+PrintFlagsFinal -version|grep manageable
intx CMSAbortablePrecleanWaitMillis = 100 {manageable}
intx CMSTriggerInterval = -1 {manageable}
intx CMSWaitDuration = 2000 {manageable}
bool HeapDumpAfterFullGC = false {manageable}
bool HeapDumpBeforeFullGC = false {manageable}
bool HeapDumpOnOutOfMemoryError = false {manageable}
ccstr HeapDumpPath = {manageable}
uintx MaxHeapFreeRatio = 100 {manageable}
uintx MinHeapFreeRatio = 0 {manageable}
bool PrintClassHistogram = false {manageable}
bool PrintClassHistogramAfterFullGC = false {manageable}
bool PrintClassHistogramBeforeFullGC = false {manag