Digital Marketing

How to take a Thread Dump from a JVM

A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM).

It is highly recommended to take more than 1 thread dump. A good practice is to take 8 thread dumps at a regular interval (eg. 1 thread dump every 8 seconds).

How to get the PID of your java process


Execute the following to create a heap dump.

jcmd [PID] GC.heap_dump [PATH]
for example:
jcmd 13898 GC.heap_dump /tmp/13898.dump
OR

To get a thread stack dump with the concurrent locks:

$ jcmd PID  Thread.print -l
for example:
$ jcmd 13898  Thread.print -l | tee /tmp/13898.thread.print.txt

(jstack and jmap are unsupported and may or may not be available in future versions of the JDK.)

Comments

Popular posts from this blog

Make online money from the Internet