barishoku/jvm-dump-analyzer

By barishoku

โ€ขUpdated 4 months ago

AI-powered JVM diagnostics tool โ€” analyze heap dumps, thread dumps, and GC logs

Image
Languages & frameworks
Developer tools
0

1.3K

barishoku/jvm-dump-analyzer repository overview

โ JVM Diagnostics Analyzer

AI-powered analysis for Java heap dumps, thread dumps, and GC logs. Upload your diagnostic files and get actionable insights powered by any OpenAI-compatible LLM. Includes an MCP server for AI agent integration and a built-in AI chat for conversational heap dump analysis.

โ Quick Start

docker run -d \
  --name jvm-diagnostics \
  -p 8080:8080 \
  -v jvm-uploads:/data/uploads \
  barishoku/jvm-dump-analyzer:latest

Open http://localhost:8080โ  โ€” a setup wizard will guide you through API key configuration on first launch.

โ What It Analyzes

โ ๐Ÿ”ฌ Heap Dumps (.hprof)

Upload a heap dump and get:

  • Leak suspect analysis โ€” identifies what's accumulating and why
  • Memory distribution โ€” class histogram and package-level breakdown
  • GC root paths โ€” traces from suspects back to roots
  • JVM configuration assessment โ€” heap sizing and GC collector recommendations
  • Risk assessment โ€” severity rating with prioritized fixes

Under the hood, the app uses Eclipse Memory Analyzer (MAT) โ€” bundled in the image โ€” to parse the .hprof file and extract a structured report, which is then sent to the AI for interpretation.

โ ๐Ÿงต Thread Dumps (.tdump, .txt)

Upload a thread dump and get:

  • Thread state analysis โ€” distribution of RUNNABLE, WAITING, BLOCKED states
  • Deadlock detection โ€” identifies and explains deadlock chains
  • Bottleneck identification โ€” lock contention, pool exhaustion, I/O stalls
  • Actionable fixes โ€” thread pool tuning, lock ordering, connection pool sizing
โ ๐Ÿ“Š GC Logs

Upload a GC log and get:

  • Pause time analysis โ€” trends, distributions, and outliers
  • Memory pressure assessment โ€” leak indicators, promotion rates, humongous allocations
  • Full GC root cause โ€” what triggers them and how to prevent them
  • Collector-specific tuning โ€” concrete JVM flags with recommended values
โ ๐Ÿ”Œ MCP Server (Model Context Protocol)

Exposes heap dump analysis tools via an SSE-based MCP server that any AI agent can connect to:

  • 7 built-in tools โ€” get_heap_summary, get_leak_suspects, get_class_histogram, get_dominator_tree, get_top_consumers, run_oql_query, get_thread_stacks
  • Standard MCP protocol โ€” Compatible with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
  • Session management โ€” Upload a heap dump on the MCP page, then connect your agent to the SSE endpoint
  • Live tool activity log โ€” See real-time tool calls and results on the MCP page

Connect to http://localhost:8080/mcp/sse after uploading a heap dump file.

โ ๐Ÿ’ฌ Built-in AI Chat

Chat with your heap dump directly from the browser โ€” no external agent needed:

  • Conversational analysis โ€” Ask questions in natural language, get structured Markdown responses
  • Real-time streaming โ€” Token-by-token LLM responses via Server-Sent Events
  • Automatic tool usage โ€” The AI calls heap analysis tools as needed to answer your questions
  • Conversation memory โ€” Context is maintained across messages within a session
  • Collapsible debug info โ€” See which tools the AI called and with what parameters

โ Configuration

โ First-Run Setup (Web UI)

On first launch, the app opens a setup wizard at /setup where you can configure:

  • API Key โ€” your OpenAI / OpenRouter / on-prem API key
  • Base URL โ€” endpoint for your AI provider (default: OpenRouter)
  • Model โ€” which model to use (default: openai/gpt-4o)
  • Temperature โ€” response randomness (default: 0.3)
  • Trust insecure TLS โ€” for on-prem models with self-signed certificates

Settings are persisted in /root/.jvm-diagnostics/config.properties inside the container.

You can change these anytime at /settings.

โ Environment Variables

All settings can also be passed as environment variables (these override the config file):

VariableDescriptionDefault
OPENROUTER_API_KEYAPI key for AI provider(required)
OPENROUTER_BASE_URLAI API endpointhttps://openrouter.ai/api
AI_MODELModel nameopenai/gpt-4o
AI_TEMPERATUREResponse temperature (0-2)0.3
AI_TRUST_INSECURE_CERTSTrust self-signed TLS certsfalse
APP_STORAGE_LOCATIONUpload directory/data/uploads
MAT_HEAP_SIZEHeap for MAT analysis4g
APP_MAT_TIMEOUT_MINUTESMAT analysis timeout30
JAVA_OPTSJVM options-Xms512m -Xmx2g
โ Example with Environment Variables
docker run -d \
  --name jvm-diagnostics \
  -p 8080:8080 \
  -e OPENROUTER_API_KEY=sk-or-v1-your-key \
  -e AI_MODEL=anthropic/claude-sonnet-4 \
  -e MAT_HEAP_SIZE=8g \
  -v jvm-uploads:/data/uploads \
  barishoku/jvm-dump-analyzer:latest
โ Docker Compose
services:
  jvm-diagnostics:
    image: barishoku/jvm-dump-analyzer:latest
    ports:
      - "8080:8080"
    environment:
      - OPENROUTER_API_KEY=sk-or-v1-your-key
      - AI_MODEL=openai/gpt-4o
      - MAT_HEAP_SIZE=4g
      - JAVA_OPTS=-Xms512m -Xmx2g
    volumes:
      - upload-data:/data/uploads
    restart: unless-stopped

volumes:
  upload-data:

โ Custom Prompts

The system prompts sent to the AI can be fully customized from the Settings page (/settings). Each analysis type (Heap Dump, Thread Dump, GC Log) has its own prompt that you can edit. The original default prompts are always preserved and can be restored with one click.

โ On-Prem / Self-Hosted LLMs

This application works with any OpenAI-compatible API. To use a self-hosted model:

  1. Set OPENROUTER_BASE_URL to your model's endpoint (e.g., https://my-llm.internal/v1)
  2. Set AI_MODEL to your model name
  3. If using self-signed TLS certificates, set AI_TRUST_INSECURE_CERTS=true

Compatible with: Ollama, vLLM, text-generation-inference, LocalAI, LMStudio, and any OpenAI-compatible server.

โ Supported Platforms

ArchitectureStatus
linux/amd64โœ… Supported
linux/arm64โœ… Supported

โ Memory Recommendations

Heap Dump SizeRecommended MAT_HEAP_SIZERecommended JAVA_OPTS
< 500MB2g-Xms256m -Xmx1g
500MB โ€“ 2GB4g-Xms512m -Xmx2g
2GB โ€“ 8GB8g-Xms1g -Xmx4g
> 8GB16g-Xms2g -Xmx8g

Tip: MAT_HEAP_SIZE controls the heap allocated to Eclipse MAT for parsing .hprof files. For large dumps, this needs to be large enough to hold the dump's object graph in memory.

โ Persistent Data

Mount a volume to /data/uploads to persist uploaded files across container restarts:

-v /path/on/host:/data/uploads

Settings are stored at /root/.jvm-diagnostics/config.properties.

โ License

MIT

Tag summary

Content type

Image

Digest

sha256:40e5b0f1fโ€ฆ

Size

289.2 MB

Last updated

4 months ago

docker pull barishoku/jvm-dump-analyzer