javaperf cpu hotspots
Finds CPU hot spots in a running Java service via JFR and the javaperf MCP server.
Free
Works with the AI Agents you already use
javaperf cpu hotspots
Example session with this skill installed
My Java service at PID 4521 is hitting 90% CPU under load. Can you find the hot spots?
- Read your context and instructions
- Compiled the javaperf cpu hotspots
I have recorded a 60-second JFR profile for PID 4521. The recording captured 5,842 CPU samples during the load window. The analysis shows the service is heavily CPU-bound, primarily due to intensive JSON serialization and regex matching in the request processing layer.
CPU Hot Spot Analysis
| Rank | Method | % Samples | Call Path | Likely Cause |
|---|---|---|---|---|
| 1 | com.auth.Token.verify() | 42.1% | AuthFilter -> JWT.parse | Re-compiling Regex pattern on every call. |
| 2 | com.data.Mapper.toJson() | 28.4% | ApiController -> Response | Reflective access in legacy Jackson version. |
| 3 | java.util.regex.Pattern.matcher | 12.8% | Token.verify | Side effect of Rank 1 method. |
| 4 | zip.Deflater.deflateBytes | 7.2% | GzipFilter | High compression level (9) on small payloads. |
Verdict: The service is compute-bound. 70% of CPU time is spent in two specific methods related to security and serialization.
Fixes to try:
- Cache Regex Patterns: Move the
Pattern.compilecall inToken.verify()to a static final constant. - Upgrade Jackson: Update
jackson-databindto 2.15+ to benefit from improved property cache lookups. - Adjust GZIP: Lower the compression level to 6 or implement a payload size threshold for compression.
Next steps
- Apply the static Regex fix and re-run the profile.
- Verify if the
com.data.Mappercan be replaced with a pre-generated serializer. - Check
compiler_codecacheif performance stays inconsistent after fixes.
Connects securely to your tools. The creator never sees your data.
About this skill
Finds CPU hot spots in a running Java service by recording JFR under load and ranking the hottest methods and call paths via the javaperf MCP server. Use when the user says the Java backend is slow, has high CPU or latency, wants to find hot spots during a load test, or asks which methods burn the most CPU.
Requires javaperf MCP server and local JVM access. JFR sampling (10ms) may miss very fast methods. Does not cover heap leaks or lock contention.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Requires