Coder Social home page Coder Social logo

toptal / jvm-monitoring-agent Goto Github PK

View Code? Open in Web Editor NEW
51.0 156.0 11.0 67 KB

Monitor JVM from within, detect thread blocks and automatically save threads dump

License: GNU Affero General Public License v3.0

Java 100.00%
jvm-monitor javaagent thread-dump

jvm-monitoring-agent's Introduction

JVM Monitoring Agent

Monitor JVM threads and save a threads dump when threads get blocked for given time.

Usage

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

Configuration flags/options

debug

Enables debugging output - in cases you suspect something is wrong it might provide additional information. To debug options problems make it first passed parameter.

path=...

Specifies where to save threads dumps.

interval=...

Specifies how often to check thread list for blocked threads. (Milliseconds)

threshold=...

Specifies how long thread needs to be blocked before dumps will be saved. (Milliseconds)

delay=...

Specifies delay between saving consecutive threads dumps. (Milliseconds)

filterRegex=...

Specifies a regular expression to filter known blocked threads. (Milliseconds)

Examples

Examples in examples/ are meant to check this library manually.

Check the agent does not interrupt exit.

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.

Check the agent does find blocked threads.

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.

License

JVM Monitoring Agent is licensed under GNU Affero General Public License (GNU AGPLv3).

jvm-monitoring-agent's People

Contributors

dazld avatar fprobst-de avatar mpapis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jvm-monitoring-agent's Issues

Send JMX notifications on stuck threads

In addition, or even instead of saving a thread dump we could also send JMX notifications that threads are stuck.

Extra idea - associate threads_dump file with a thread and when it get's unblocked - trigger a notification with the file name.

Use milliseconds instead of Date for timestamp

To limit strain on GC we can simplify blockedThreads to include long of milliseconds(System.currentTimeMillis()) instead of Date.

Relevant lines:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.