Java Thread dump with JCMD

7.6k Views Asked by At

I am using Java1.8 in Ubuntu Linux machine. Created a thread dump with below command:

jcmd 1670 Thread.print > Thread.jfr

Copied File to local MAC machine and double clicked to open in JMC. It failed to open. HOw to open it?

I tried to open same file in STS with memory analyzer installed, it does not identify jfr file.

1) What is the wrong with above approach?

2) What is the best tool to analyze Thread and Heap dump?

3) Is Heap or Thread dump size is dependent on RAM size? we have 64 GB ram system, assigned 40GB to one of app server. Is any problem with this?

1

There are 1 best solutions below

0
On

1) A JFR file is a file with plenty of information produced by the JDK Flight Recorder. It is in a binary format. You can’t just rename a textual thread stack dump to make it a flight recording.

2) Depends on what you’re looking for. Eclipse MAT is good for heap dumps. If you want to do heap waste analysis, JOverflow is good (see my blog at http://hirt.se/blog/?p=854). There is a thread analysis plugin for JMC, but I’ve gotten used to have richer information than just thread stack dumps. I suggest taking a closer look at JFR and JMC.

3) Heap dumps will, depending on how you dump, be proportional to the live data on your Java heap. Thread stack dumps will be proportional to the number of threads and how deep the traces are.

If you want to learn more, check out this blog: http://hirt.se/blog/?p=939