Fetching Server Thread and Heap Dumps
Server Thread Dumps
Thread dumps of a java process can be retrieved using Jstack.
jstack is an inbuilt tool provided by Java packaged with the Java Development Kit.
Fetch Server Process ID
Get the server's JVM Process ID.
Server's Process ID is available in the console.
Figure 1: Gateway Server Console showing Server's Process ID
For servers running as service, the process ID will be available in the service logs being logged to the service.log file of the server
Server Thread Dumps from JVM Process ID using jstack
After fetching server's process ID, to get the thread dump using jstack, open a new console window and use the command below to store the thread dump to the threadDump.txt file:
jstack <pid> >> threadDump.txt
Figure 2: jstack command
If the jstack command is not found in the command prompt, then go to the folder where jstack is present (in the Java installation directory, for example, C:\Program Files\Java\jdk1.8.0_121\bin) and run the above commands.
To analyze the status of the each thread of the server, take 5 times of threaddumps with a time interval of 5 seconds.
Server Heap Dumps
Server Heap Dumps from JVM Process ID using jmap
After fetching server's process ID, to get the heap dump using jmap, open a new console window and use the following command to store the heap dump to heapDump.bin file:
jmap -dump:format=b,file=heapDump.bin <pid>
Figure 3: jmap Command