The Hotspot Claude Would Never Have Found by Reading the Code
CommaFeed is my daily RSS reader. It is open source, and its creator runs a free public instance at commafeed.com. Every time I refresh my feeds, someone else's server does the work. So when I wondered where all that work actually goes, I pointed Claude Code and the JProfiler MCP at it.
As a result, a database optimization was merged into CommaFeed. The fix itself was not complicated, but Claude would never have come up with it from the source code alone. I asked afterward, and it confirmed as much: its natural first attempt would have fixed the wrong thing. Read on for how Claude Code, connected to the JProfiler MCP server, took me from curiosity to a merged PR.
JProfiler 16.1: AI Agents Can Now Profile Your Java Applications
Since JProfiler 1.0, profiling has been something a developer does with a GUI. You start a session, navigate views, and interpret data. In practice, this means that performance analysis only happens when a problem is serious enough to justify the context switch, and many issues ship to production without ever being profiled.
With JProfiler 16.1, we are changing how profiling works: AI coding agents can now profile your Java applications, analyze the results, and act on them. This is the biggest change in how developers use profiling since we started.
The new JProfiler MCP server, available as the @ej-technologies/jprofiler-mcp npm package, exposes JProfiler's
profiling and heap analysis capabilities through the
Model Context Protocol. It works with Claude Code, Cursor, Codex,
Gemini CLI and any other MCP-compatible AI coding tool.
Breaking the LLM Black Box: Custom Categorization in JProfiler
Modern agentic applications often perform a wide range of logical tasks through a single interface. While these operations have vastly different performance and cost profiles, they appear as an undifferentiated call tree in traditional profilers.
By default, JProfiler groups these requests by model name, which provides a high-level overview but lacks the granularity needed to distinguish between different functional workloads.
This screencast shows how to move beyond this predefined perspective with scripts that define your own categorization rules based on internal metadata, instruction structure, or application state.
Profiling AI: LangChain4j and Spring AI
Agentic applications introduce unique profiling challenges. Beyond standard CPU usage, performance and costs are determined by the complex structure of prompts, RAG retrievers, and tool calls that remain hidden behind framework abstractions.
To avoid vendor lock-in, most developers use frameworks like LangChain4j or Spring AI. JProfiler’s AI probe provides deep visibility into these frameworks.
This screencast walks through profiling a LangChain4j customer support agent, showing how the AI probe visualizes prompt compositions, isolates token-heavy outliers, and projects resource costs directly onto the recorded call tree.
JProfiler 16: Profiling Agentic Java Applications
Why AI Needs Profiling
Traditional profiling focuses on the JVM's internal execution, like method durations, memory allocation, and thread synchronization issues. One of JProfiler's main innovations of the past is grounded in its probes: Measurements of higher-level systems, like HTTP, JDBC, and RPC calls. With LLM frameworks like LangChain4j and Spring AI, a new performance challenge has emerged. LLM interactions introduce highly non-deterministic latency and substantial resource costs that standard CPU profiling cannot put into context. JProfiler is in a unique position to bridge this gap by treating AI interactions as a data source for a new probe.
The power of async tracking in JVM profiling
Async operations can speed up applications and improve responsiveness, but they also introduce complexity. Especially in the context of profiling, understanding what really happened and why can be surprisingly tricky. This post shows how JProfiler's async tracking feature helps fix hard performance problems in your application.
Heap Walker scripting for snapshot analysis
Previously, JProfiler's heap walker only offered advanced filtering and grouping features in live sessions. With JProfiler 15, the heap walker introduces full support for filtering and grouping in snapshots. A new API lets you write scripts to filter objects or define custom grouping logic based on dumped object data.
This screencast demonstrates the new functionality with a small Hibernate-based demo that creates different types of query cache entries. Hibernate’s second-level cache can quickly fill up with unexpected entries, and identifying what’s taking up space is key to resolving memory issues. JProfiler now makes it possible to answer such questions with snapshots.
The screencast shows how you can:
- Group cache keys by query structure to compare memory impact
- Use object set filter scripts to isolate problematic cache entries
- Use merged dominating references to understand why objects are retained
Capturing and comparing MBean states with JProfiler
MBeans expose a wide range of runtime metrics and management operations that are essential for understanding the internal state of Java applications. Traditionally, JProfiler has supported live inspection of MBeans during a profiling session.
With the new MBean snapshot feature in JProfiler 15, it is now possible to capture the complete MBean state, compare snapshots, and analyze metrics offline, even after the application has shut down.
This screencast demonstrates the new functionality with a small Hazelcast application that performs random map operations and registers a custom MBean for triggering cleanup operations.
Along the way, you will see how to:
- Capture and compare MBean snapshots manually
- Trigger MBean snapshots programmatically with method triggers
- Restrict the snapshot scope to specific MBeans
Advanced SSH remote profiling with JProfiler
Remote profiling can be challenging when SSH access involves custom setups, proxies, or cloud authentication plugins. JProfiler 15 introduces advanced SSH connection features that remove these obstacles, enabling profiling in complex environments without manual setup.
This screen cast shows how to profile remote JVMs even in situations where the built-in SSH client is insufficient, using AWS Session Manager as an example.
Along the way, you will see how to:
- Use OpenSSH mode for remote profiling
- Connect with ProxyCommand and the AWS CLI
- Handle SSH port forwarding restrictions with netcat mode
Profiling Java applications in VS Code with JProfiler
JProfiler now integrates directly into VS Code, bringing the powerful profiling tool into your everyday development workflow.
In this screencast, we profile the Spring Pet Clinic demo and walk through the features of the JProfiler extension for VS Code, including:
- Toggling profiling mode
- Automatic setup of profiled packages
- Source code navigation from profiling views
- Attach mode for unsupported launch methods (like Maven)
- Built-in Gradle integration
If you're using a launch method in VS Code that isn't currently supported, let us know, we’re always looking to expand support.