JVM性能监控与故障处理工具之jinfo

一、简介

jinfo(Configuration Info for Java)的作用是实时地查看调整虚拟机各项参数。

jinfo参数如下:

jinfo -help

Usage:
    jinfo [option] <pid>
        (to connect to running process)
    jinfo [option] <executable <core>
        (to connect to a core file)
    jinfo [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    -flag <name>         to print the value of the named VM flag
    -flag [+|-]<name>    to enable or disable the named VM flag
    -flag <name>=<value> to set the named VM flag to the given value
    -flags               to print VM flags
    -sysprops            to print Java system properties
    <no option>          to print both of the above
    -h | -help           to print this help message

二、使用

1. 查看

查看参数,使用jinfo <pid>即可,

Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = /usr/java/jdk1.7.0_03/jre/lib/amd64
java.vm.version = 22.1-b02
zookeeper.root.logger = INFO,CONSOLE
com.sun.management.jmxremote.local.only = false
java.vm.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.rmi.server.randomIDs = true
path.separator = :
......

VM Flags:

-Xms64m -Xmx512m -XX:MaxPermSize=256m -Dfile.encoding=utf-8 

2. 调整

可以使用jinfo -flag [+|-] name <pid>或者jinfo -flag name=value <pid>在运行期修改参数,例如jinfo -flag +HeapDumpAfterFullGC <pid> 命令,开启所指定的 Java 进程的HeapDumpAfterFullGC参数。

可以通过java -XX:+PrintFlagsFinal -version | grep manageable查看允许修改的参数。

image.png

三、参考资料
深入理解Java虚拟机

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。