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.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 5 days ago
- Free to download with an account
Requires