Java thread stack, memory overflow, leaks, deadlocks, etc.

Monitoring tools

Used to monitor JVM performance parameters

1. jps – JVM Process Status Tool

Jps-ml: jps-ml: jps-ml: jps-ml: jps-ml: jpS-ml: jpS-ml: jpS-ml

2. jstat – JVM Statistics Monitoring Tool

Jstat -gc {pid} {interval} {count} Jstat -gc {pid} {interval} {count}

Debugging tools

Used to locate a specific problem

1. jinfo – Configuration Info

This command is used to display Java process configuration information, including Java system properties and Java VIRTUAL machine command-line interface (CLI) parameters. You can view and adjust VM parameters. jinfo -sysprops {pid}

2. jhat – Heap Dump Brower

Jhat-port {XXX} {dumpFileName} You can enter hostName:port in the address box of the browser to view the information

3. jmap – Memory Map

Jmap-heap {PID} Displays the heap memory usage. Jmap-histo [:live] {pid} displays the number and size of objects in the heap memory. If live is used, only live objects are counted. Jmap -dump:format=b,file={dumpFileName} Exports the process memory usage to a file. You can use tools such as MAT or Jhat to view the memory usage

4. jstack – Stack Trace

View the stack information of the thread in a Java process. It is a snapshot of the current time. It is often used to find the thread that consumes the most CPU in the Java process.

  1. Run ps -ef to find the Java process Id.
  2. Top-hp {PID} is used to find the most CPU consuming thread A;
  3. A converted to hexadecimal;
  4. Jstack} {pid | grep {A} output stack information, and then further positioning by finding corresponding code.

Can also be used to locate deadlocks, deadloops and other problems