JVM Thread Wait Analysis via State Sampling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Java application programs executing in a Java Virtual Machine often experience excessive waiting, leading to degraded performance and increased response times due to competition for resources, necessitating the detection and analysis of waiting threads to identify the causes of degradation.
Innovation Solution
A computer-implemented method and system that samples execution states of Java application programs, counts occurrences, and stores this data to identify the reasons for waiting, allowing developers to make informed changes to reduce wait times by monitoring and analyzing Java threads using the Java Virtual Machine Tool Interface (JVMTI) within the Java 2 Software Development Kit (SDK) 1.5 facility.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If Java application programs execute concurrently in the JVM, then productivity is improved through parallel processing, but waiting time increases due to resource competition
Solution Approach 1:
The system performs preliminary sampling of thread execution states at regular intervals to collect wait time data before analyzing it. By continuously sampling execution states (WAITING, BLOCKED, RUNNABLE) and accumulating statistics in advance, the system can identify wait patterns without blocking thread execution, thus maintaining productivity while preparing data for later analysis to reduce waiting time.
Solution Approach 2:
The system implements feedback by analyzing collected wait time statistics and providing degradation analysis results that identify the causes of waiting. This feedback loop allows developers to understand why threads are waiting and make targeted code changes to reduce wait times, thereby improving the concurrent execution efficiency without sacrificing productivity.
2Measurement precision
If thread waiting is monitored and analyzed, then measurement precision of wait causes is improved, but device complexity increases due to additional monitoring mechanisms
Solution Approach 1:
The monitoring system leverages the existing JVMTI infrastructure and JVM thread state enumeration mechanisms to achieve multi-functionality. By using the standard `Thread.State` enum and existing sampling frameworks, the system provides comprehensive wait cause analysis without requiring separate complex monitoring components for each thread state, thus improving measurement precision while controlling device complexity.
Solution Approach 2:
The system employs self-service by having threads naturally expose their execution states through the JVM's built-in threading model. Threads automatically transition between WAITING, BLOCKED, and RUNNABLE states, and the sampler passively collects this information without actively interfering with thread execution or requiring threads to report their own states, thereby simplifying the monitoring architecture while maintaining precise measurement.
3Measurement precision
If execution states are sampled continuously, then measurement precision of wait patterns is improved, but loss of time increases due to sampling overhead
Solution Approach 1:
The system applies partial action by sampling execution states at strategically selected intervals rather than continuously monitoring every microsecond. By using reasonable sampling rates that capture meaningful wait patterns while avoiding excessive sampling frequency, the system achieves sufficient measurement precision for identifying wait causes without incurring significant sampling overhead that would degrade application performance.
Data Source
AI summary
Various embodiments of a computer-implemented method, system and computer program product determine degradation of an application program. At least one execution state of the application program, executing in a virtual machine, is sampled. A number of occurrences of the at least one execution state are counted to provide at least one count. The at least one execution state and at least one count, respectively, are stored.


