JVM command line monitoring tool jcmd

Introduction to jcmd

After JDK1.7, Java added a new command line tool jcmd. jcmd is a versatile tool that can be used to implement the functions of all the previous commands except jstat. For example: use it to export heap, memory usage, view Java processes, export thread information, perform GC, JVM runtime, etc.

jcmd has most of the functions of jmap, and it is also recommended to use the jcmd command instead of the jmap command on Oracle's official website.

官网:https://docs.oracle.com/en/java/javase/11/tools/jcmd.html

View the process number (same as jps)

insert image description here

See which commands the specified process applies to

insert image description here

View thread information (same as jstack)

insert image description here

View the histogram of classes (same as jmap -histo)

insert image description here

Heap dump function (same as jmap -dump)

insert image description here

View the running time of the Java process

insert image description here

[root@bogon ~]# jstat -class -t 4622
Timestamp       Loaded  Bytes  Unloaded  Bytes     Time   
          893.4    425   880.7        0     0.0       0.11
[root@bogon ~]# jcmd 4622 VM.uptime
4622:
897.023 s

Print system property information (jinfo -sysprops process ID)

insert image description here

View modified parameters after JVM startup

insert image description here

jcmd 4622 VM.flags
jinfo -flags 4622

Guess you like

Origin blog.csdn.net/fengsheng5210/article/details/123669337