SpyGlass Thread Monitor
SpyGlass Thread Monitor is a free VisualVM plugin to monitor thread activity in J2EE systems.
Its concept is similar to Windows Task Manager: a little utility to understand which threads is consuming CPU and why.
Information is collected using JMX so you have to remember to activate it on your server and enable JMX ports in your network you decide to work remotely.
In Applicative Package Filter you can define packages (separated by a ';') that contain application code. This information is used to identify which threads are executing applicative requests in a specify moment.
SpyGlass Thread Monitor is composed by 3 main parts:
- Performance Statistics
- Thraed Statistics
- CPU intensive Thread details
Looking at previous picture you can understand how this plugin is organized.
Each section can be hidden using check box in the upper right corner.
This section presents realtime statistics related to logic CPU usage.
System Load reports real time CPU % usage.
CPU time reports the same information than System Load but using CPU consumption in milliseconds for the sampling period (about 1 seconds).
Applicative Threads reports the number of threads with a stack trace line that contains one of defined applicative package. This can be used as an indicator of how many applicative requests are served by the system.
This section is used to present real time global thread information.
Thread Summary presents threads collected by state information.
In this chart you can see if there are blocked threads (in red) or how many runnable threads you have.
Thread Type respond to the question "How many threads I have?" reporting also thread daemon number and thread peak number.
Then you can see a chart reporting Runnable Thread number. You can use it to respond to the question: "How many running thread may I have?"
I/O Threads chart reports the number of threads working on java.io or java.net and can be used to have an idea of how may treads are working on I/O (or waiting).
Blocked Threads and Deadlocked Threads cam be used to monitor lock contention in your application execution. They are really useful for performance optimization and deadlock analysis. Even if this is only a qualitative information, recurring blocked threads are evidence of problems with monitors in your application. You can refer to SpyGlass Thread Lock Monitor for detailed information on how to monitor blocked threads.
Native threads chart reports the number of native threads. In normal J2EE systems it is usual to see many native threads due to java.nio package usage. On the other hands, desktop application can be based on native code libraries to integrate specific hardware resources and drivers.
This table represents most consuming threads. It can be activated selecting User Time and/or System Time check boxes in the upper right corner.
Enabling these check you inform the system to collect also CPU usage information for each threads. Because this could be an expensive operation you have to enable/disable it manually.
SpyGlass Thread Monitor is configured to collect this information each 10 sampling intervals (this means about every 10 seconds).
We estimate that this operation requires about 200ms server time.This means 200/10.000 as an impact: about 2% of a single logical CPU time.
If you're not interested in this specific information for a period of time we suggest leaving both unchecked.
This table presets following details for most consuming threads:
- Thread ID/Thread Name
- Thread State
- CPU % usage of a logical CPU time: if you have more logical CPU the sum of CPU % can be more than 100%
- CPU Time: CPU usage in ms
- User/System Time represent CPU usage by user code or OS code
- Blocked Time reports how many millis are spent in blocked state
- Wait Time, the same as previous but for waiting and Time Waited state
- Stacktrace reports current thread stack trace: moving on it will show a tooltip with stacktrace information filtered on applicative package filter
tags: Thread Analysis SpyGlass Thread Monitor