Friday, September 4, 2020

How to collect the the java heap dump.

 
 
 You can use jmap to collect a dump of any process that is running but you must know the process ID (pid). This is the command that you can use to obtain the pid of a Tomcat process:
 
 1) ps -eaf | grep tomcat
 
 to collect the Java heap dump:

 Log in to a running Tomcat server from which you need to collect the heap dump.

 Switch to the tomcat user:
 
 2) sudo su -tomcat
 
 Browse to the jmap path.

 Run this command to collect the heap dump and write it to a file without killing the process ID:
 
  3) jmap -dump:format=b,file=cheap.bin <pid>
 
Example

[root@sukhoi ~]#/opt/java-8u102/bin/jmap -dump:format=b,file=/mnt/sukhoi/archives/testheap.bin - F <TOMCAT PID>

/opt/java-8u231/bin/jmap -dump:format=b,file=/sukhoi.bin   2153

After you collect the heap dump, send it to the development team for analysis.

No comments:

Post a Comment