SpyGlass Thread Lock Monitor
SpyGlass Thread Lock Monitor is a free VisualVM plugin to monitor Java thread locks in real time.
Thread locks are one of the most common cause for increasing response time when application usage increase. They are generated by resource contention among applicative and system threads.
If you're system is not perfectly architectured you can experience slow response time due to resources and data structure contention. The only way to discover these problems is related to the possibility to log lock events in production system or during stress test application.
This plugin collects statistics from Java JMX and presents information in a clear and immediate form to verify threads locks and identify their causes.
This plugin checks JMX thread metrics about every 1000 ms and reports lock information as events in the lower table.
Using this approach you're not sure to get all lock events, but you're sure to limit overhead on your application server.
Lock events are a substantial problem only if one of the following condition is true:
- lock is really frequent
- large lock duration (many milliseconds)
If locks are frequent or long enough, you have a good possibility to get it. On the other hand, you can consider them not so critical.
This chart reports how many thread are in blocked state during sampling.
This chart reports how many ms are lost in blocked state by system in current sampling time.
This is a good estimation of how many time your application looses for thread locks.
You can also note that there are many minor locks during application execution probably related with application system activity.
To enable lock time you need to set ThreadContetionMonitoringEnabled a true in Threading MBean:
You can use VisualVM MBeans to do this.
Finally, you have a chart reporting locking count events to JVM level.
Don't worry if they seems too much. Most of them are JVM related locks with minor impacts on application performance.
The table reports information for captured locks:
- event timestamp
- blocked thread name and id
- blocked thread stacktrace (leave mouse pointer over to see complete stacktrace)
- blocked time during last sampling interval
- block count during last sampling interval
- lock object (contended resource)
- locker thread name and id
- locker stacktrace (leave mouse pointer over to see complete stacktrace)
VisualVM 1.3.1 or better is required to run SpyGlass Garbage Collector Analyzer. You can look at your bin directory inside your JDK 1.6.x or better or you can download it by yourself (http://visualvm.java.net/)
This plugin cannot be distributed with other products or inside any commercial product package.
See license for more details.
tags: Thread Analysis VisualVM Plugin SpyGlass Thread Lock Monitor Deadlocks