Taking a Thread Dump on *nix
TO TAKE A THREAD DUMP
-
We want to take ten thread dumps every few seconds (maybe 5 seconds apart) so that we can analyze the work of the SymmetricDS instance over time.
-
Run jcmd command from the command line on the server running the SymmetricDS instance. This will show the Java processes and their process IDs that are currently running.
# jcmd
3927 sun.tools.jcmd.JCmd
1421 /Users/philipmarzullo/symmetric/lib/symmetric-wrapper.jar exec /Users/philipmarzullo/symmetric/conf/sym_service.conf
1422 org.jumpmind.symmetric.SymmetricLauncher --max-idle-time=90000 --no-log-console
-
The line that contains the org.jumpmind.symmetric.SymmetricLauncher class running as the main is the one that you are interested in.
-
Run the following command every 5 seconds 10 times.
jstack -l 1422 >/tmp/threaddump.`date +"%Y-%m-%d-%T"`
- Find the files
ls -l /tmp/threaddump.*
-rw-r--r-- 1 philipmarzullo wheel 54233 Dec 20 09:07 /tmp/threaddump.2019-12-20-09:07:57
-rw-r--r-- 1 philipmarzullo wheel 54232 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:01
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:06
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:10
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:16
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:21
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:27
-rw-r--r-- 1 philipmarzullo wheel 55337 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:32
-rw-r--r-- 1 philipmarzullo wheel 55336 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:38
-rw-r--r-- 1 philipmarzullo wheel 55336 Dec 20 09:08 /tmp/threaddump.2019-12-20-09:08:43