Monitor JVM threads and save a threads dump when threads get blocked for given time.
Download the jar from https://github.com/toptal/jvm-monitoring-agent/releases
Add it to the command line of the application you wish to monitor:
java -javaagent:jvm-monitoring-agent-0.9.0.jar=threshold=1000,debug ...rest of command
Enables debugging output - in cases you suspect something is wrong it might provide additional information. To debug options problems make it first passed parameter.
Specifies where to save threads dumps.
Specifies how often to check thread list for blocked threads. (Milliseconds)
Specifies how long thread needs to be blocked before dumps will be saved. (Milliseconds)
Specifies delay between saving consecutive threads dumps. (Milliseconds)
Specifies a regular expression to filter known blocked threads. (Milliseconds)
Examples in examples/
are meant to check this library manually.
rm tmp/*
ant && (cd examples/empty/ && ant) &&
java -javaagent:dist/jvm-monitoring-agent.jar -jar examples/empty/dist/empty.jar
ls -l tmp/
There should be no output from the execution.
rm tmp/*
ant && (cd examples/SynchronizedThreads/ && ant) &&
java -javaagent:dist/jvm-monitoring-agent.jar=debug,threshold=1000,delay=5000 -jar examples/SynchronizedThreads/dist/SynchronizedThreads.jar
ls -l tmp/
Execution is supposed to show arguments and times it took each second.
JVM Monitoring Agent is licensed under GNU Affero General Public License (GNU AGPLv3).