jvmdiag
AI-assisted JVM diagnostics for SREs: Go CLI, Web UI, MCP and Kubernetes ephemeral-container capture.
A single-binary tool for investigating JVM performance and memory problems. Analyze existing diagnostic files or collect evidence from a running JVM, then inspect the results through the CLI, Web UI or MCP. AI interpretation is optional; local static analysis works without an API key. Native HPROF analysis does not compute retained heap or prove a memory leak. Live capture and binary JFR decoding need compatible JDK tools. See diagnostic scope and limitations. Download a verified binary using the installation guide, or build from source using the Go version in .go-version:
Summary extracted from the README.
jvmdiag
A single-binary tool for investigating JVM performance and memory problems. Analyze existing diagnostic files or collect evidence from a running JVM, then inspect the results through the CLI, Web UI or MCP. AI interpretation is optional; local static analysis works without an API key.
What can I investigate?
| Situation | Workflow |
|---|---|
| Slow responses, lock contention or suspected stuck threads | Analyze thread dumps and compare successive snapshots. |
| Growing heap or suspected memory leaks | Inspect HPROF payload histograms and compare dumps; use optional Eclipse MAT for retained-heap analysis. |
| GC pressure, allocation hotspots or JVM pauses | Analyze GC logs and JFR recordings. |
| Native memory growth or JVM crashes | Analyze NMT summaries and crash logs. |
| Several artifacts from the same incident | Combine thread, heap, GC, NMT and JFR evidence in an incident report. |
| A Java application running in Kubernetes | Add a temporary diagnostic container, discover the JVM and capture evidence without rebuilding the application image. |
| Team or assistant access | Run the shared Web/API server or connect an MCP client. |
Native HPROF analysis does not compute retained heap or prove a memory leak. Live capture and binary JFR decoding need compatible JDK tools. See diagnostic scope and limitations.
Get started
Download a verified binary using the installation guide, or build from source using the Go version in .go-version:
git clone https://github.com/bishoku/jvmdiag.git
cd jvmdiag
go build -trimpath -o jvmdiag ./cmd/jvmdiag
./jvmdiag serve --port 8080
Open http://localhost:8080 to upload diagnostic files and view reports. The local server binds to loopback by default. For team access, follow shared-server configuration.
Usage examples
Analyze existing files
./jvmdiag analyze thread-dump.tdump --no-ai
./jvmdiag analyze gc.log --type gc --no-ai
./jvmdiag analyze app.hprof --no-ai
./jvmdiag analyze recording.jfr --no-ai
Compare snapshots and correlate an incident
./jvmdiag diff before.tdump during.tdump after.tdump --no-ai
./jvmdiag diff baseline.hprof after-load.hprof --no-ai
./jvmdiag incident --gc gc.log --thread before.tdump,during.tdump --heap app.hprof --no-ai
Capture a local JVM
./jvmdiag ps
# Replace 12345 with the discovered JVM PID.
./jvmdiag capture --pid 12345 --count 3 --interval 2s \
--out-dir /tmp/jvm-case-001 --out /tmp/jvm-case-001/report.md --no-ai
Thread dumps and available NMT data are collected by default. Heap dumps and JFR are opt-in. Use a new output directory for each capture.
Investigate a Kubernetes Pod
Build the diagnostic image, make it available to the cluster, and set the custom profile's UID/GID to match the target JVM. Replace the namespace, Pod, target container and image below:
kubectl debug -n YOUR_NAMESPACE YOUR_POD -it \
--container=jvmdiag-001 --target=java \
--image=YOUR_REGISTRY/jvmdiag:diagnostic-jdk17 \
--profile=restricted --custom=deploy/kubernetes/profile-restricted.json \
-- /bin/sh
Inside the temporary container:
jvmdiag ps
# Use the discovered PID; this example assumes PID 1.
jvmdiag capture --pid 1 --container --count 3 --interval 2s \
--out-dir /tmp/case-001 --out /tmp/case-001/report.md --no-ai
cat /tmp/case-001/report.md
Keep the debug shell open while copying results from another terminal:
kubectl cp -n YOUR_NAMESPACE -c jvmdiag-001 YOUR_POD:/tmp/case-001 ./case-001
The target image needs no shell or JDK tools. The Kubernetes guide covers permissions, compatible JVMs, heap/JFR capture, cleanup, troubleshooting and repeatable kind/MicroK8s tests. Heap capture may pause the application; diagnostics share Pod/node resources.
Use AI, a shared server or MCP
# Configure your AI provider in Settings first.
./jvmdiag analyze app.hprof --ai
# JVMDIAG_ACCESS_TOKEN must contain your workspace access token.
./jvmdiag analyze app.hprof --server https://diag.example.com --workspace payments-team
# Local stdio MCP server; binary JFR/live operations still need JDK tools.
./jvmdiag mcp --file app.hprof
Documentation
- Installation, containers and upgrades
- Kubernetes live diagnostics
- Web UI server on Kubernetes and OpenShift
- Large dump limits and sizing
- Container image with preinstalled Eclipse MAT
- MAT downloads behind a proxy or offline
- Architecture and capabilities
- Shared-server security and configuration
- Diagnostic metrics, evidence and limitations
- Testing and JVM regression dataset
- Release process
- Product review and MicroK8s validation, 2026-10-24
Licensed under Apache-2.0. See contributing, the code of conduct, security policy and third-party notices.