Java virtual machine performance monitoring and troubleshooting tools, virtual machine troubleshooting
1. jdk command line tool
1) jps: Virtual Machine Process status Tool
Jps [option] [hostid]
Main parameters:
2) jstat: Virtual Machine statistics monitoring tool
Jstat-<option> [-t] [-h <lines>] <vmid> [<interval> [<count>]
Main parameters:
For example, if the gc information of process 8675 is queried twice every 8675 ms, jstat-gc 1000 2
3) jinfo: Java configuration information tool
Allows you to view and modify VM parameters in real time.
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)
For example, query the maximum allocable size of the new generation memory in the Java heap area of the VM.
4) jmap: Java memory image tool
Usage:
Jmap [option] <pid>
(To connect to running process)
Jmap [option] <executable <core>
(To connect to a core file)
Jmap [option] [server_id @] <remote server IP or hostname>
(To connect to remote debug server)
Common parameters:
Example:
5) jhat: Virtual Machine heap dump snapshot analysis tool
The built-in http server can be used to analyze dump files generated by jmap.
For example:
Access http: // 192.168.10.92: 7007/
6) jstack: generate the thread snapshot (threaddump or javacore file) at the current time of the VM ).
Usage:
Jstack [-l] <pid>
(To connect to running process)
Jstack-F [-m] [-l] <pid>
(To connect to a hung process)
Jstack [-m] [-l] <executable> <core>
(To connect to a core file)
Jstack [-m] [-l] [server_id @] <remote server IP or hostname>
(To connect to a remote debug server)
Main parameters:
7) hsdis: Code disassembly generated by JIT
2. visualization tools
Jconsole and visualvm (omitted)
References
Deep understanding of Java Virtual Machine: JVM advanced features and best practices (version 2nd)