javaperf memory gc
Diagnoses high JVM memory usage, GC pauses, and allocation pressure via the javaperf MCP server.
Free
Works with the AI Agents you already use
javaperf memory gc
Example session with this skill installed
My Spring Boot service is experiencing 500ms GC pauses every 10 seconds. Can you diagnose the cause and suggest improvements? The PID is 4521.
- Read your context and instructions
- Compiled the javaperf memory gc
I have analyzed the JVM metrics and JFR profile for PID 4521. The service is suffering from high allocation pressure in the young generation, leading to frequent minor GCs.
JVM Memory and GC Diagnosis
Target and JVM Config
- PID: 4521 (Spring Boot)
- GC Algorithm: G1GC
- Heap Limits: -Xms2g, -Xmx4g
- Container Limits: 6GB RAM (cgroups detected)
GC Health
- Total Pause Time: 4.2s over 60s window
- Max Pause: 512ms
- Frequency: Every 9.8s
- Efficiency: Low (avg 120MB freed per minor GC)
Verdict: Allocation rate (240MB/s) is exceeding the short-lived object reclamation capacity, forcing premature promotion.
Top Allocators
| Stack / Allocation Site | Bytes | Count | Fix Idea |
|---|---|---|---|
com.api.dto.Mapping.transform() | 1.8 GB | 45,000 | Use a singleton ObjectMapper or streaming API |
java.lang.StringBuilder.append() | 920 MB | 120,000 | Pre-size builders for large logging strings |
org.hibernate.internal.CacheImpl | 410 MB | 12,000 | Reduce query result set size |
Off-Heap Summary
- Code Cache: 42MB used / 240MB max
- Metaspace: 112MB used / Unlimited max
- Direct Buffers: 15MB
Recommendations
1.
Optimize DTO Transformation: The transform method is creating excessive short-lived objects. Refactor to reuse buffers or use a more memory-efficient mapping strategy.
2. Adjust G1 Region Size: Increase -XX:G1HeapRegionSize=8M to handle larger allocations more efficiently.
3.
Tune Initiating Heap Occupancy: Set -XX:InitiatingHeapOccupancyPercent=35 to start concurrent marking earlier and avoid evacuation failures.
Next steps
- Apply the
ObjectMapperoptimization incom.api.dto.Mapping. - Restart the service with
-XX:+PrintGCDetailsand the suggested G1 flags. - Re-run the
javaperfprofile during the next peak load to verify pause reduction.
Connects securely to your tools. The creator never sees your data.
About this skill
Diagnoses high JVM memory usage, long or frequent GC pauses, and allocation pressure in a running Java app via the javaperf MCP server (JFR allocation profile, GC efficiency, heap and native memory summaries). Use when the user reports GC pauses, high heap or RSS usage, OutOfMemory risk, too many allocations, or asks to tune heap or GC settings. Not for slowly growing leaks.
Requires local attach access on same host/user. JFR 10ms sampling may miss fast methods. NMT requires -XX:NativeMemoryTracking flag. Not for slow-growing leaks.
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