环境:java version "1.8.0_131"
查看某个进程所有参数配置
[root@izbp1c /]# jps
15154 -- process information unavailable
24979 jar -- 目标进程
17544 Jps
16573 Logstash
[root@izbp1c /]# java -XX:+PrintFlagsFinal 24979 --> 查看jvm所有当前服务使用的配置参数
所有参数中只有末尾以 {manageable} 标识的参数才是可以实时修改的参数,具体参数列表如下:
参数 | 参数类型 | 默认值 | 可修改标志 |
CMSAbortablePrecleanWaitMillis | intx | = 100 | {manageable} |
CMSTriggerInterval | intx | = -1 | {manageable} |
CMSWaitDuration | intx | = 2000 | {manageable} |
HeapDumpAfterFullGC | bool | = false | {manageable} |
HeapDumpBeforeFullGC | bool | = false | {manageable} |
HeapDumpOnOutOfMemoryError | bool | = false | {manageable} |
HeapDumpPath | ccstr | = | {manageable} |
MaxHeapFreeRatio | uintx | = 70 | {manageable} |
MinHeapFreeRatio | uintx | = 40 | {manageable} |
PrintClassHistogram | bool | = false | {manageable} |
PrintClassHistogramAfterFullGC | bool | = false | {manageable} |
PrintClassHistogramBeforeFullGC | bool | = false | {manageable} |
PrintConcurrentLocks | bool | = false | {manageable} |
PrintGC | bool | = false | {manageable} |
PrintGCDateStamps | bool | = false | {manageable} |
PrintGCDetails | bool | = false | {manageable} |
PrintGCID | bool | = false | {manageable} |
PrintGCTimeStamps | bool | = false | {manageable} |
修改方法:jinfo -flag 参数名=要设置参数值 ${ service PID }
如:
jinfo -flag +HeapDumpAfterFullGC { java-pid } --- 开启HeapDumpAfterFullGC
jinfo -flag -HeapDumpAfterFullGC { java-pid } --- 关闭HeapDumpAfterFullGC
jinfo -flag +HeapDumpBeforeFullGC { java--pid } --- 开启
jinfo -flag -HeapDumpBeforeFullGC { java--pid } --- 关闭
jinfo -flag HeapDumpPath=../heap.hprof { java--pid } ---指定dump快照路径