JVM Garbage Collection Pauses
Diagnose and reduce JVM GC pause times that cause latency spikes and health check failures.
Overview
Overview
JVM garbage collection pauses are one of the most common causes of latency spikes in Java, Kotlin and Scala services. During a Stop-The-World pause, the JVM suspends every application thread to find and reclaim unreachable objects, so from the caller's side the service simply stops responding.
The damage spreads outward in a chain. An allocation wave fills the heap, and a GC is triggered. The Stop-The-World pause suspends all application threads, so requests stall and connections time out. Health checks then fail and SLOs are violated, and the stalls turn into cascading failures in upstream services.
Key concepts
- Stop-The-World Pause
- G1GC
- ZGC
- -Xmx
- GCEasy
Interview questions
- How do you enable and analyze GC logs to identify the cause of a latency spike?
- How should you size JVM heap for a containerized Java application to avoid both GC overhead and OOM kills?
- When should you choose ZGC or Shenandoah over G1GC?
Sign up free to read the full topic
More Troubleshooting topics
- EC2 Instance Unresponsive
- ECS Task Failures and Restarts
- ELB 5xx Errors
- Flaky CI/CD Pipeline Failures
- HPA Not Scaling
- IAM Permission Denied Errors
- Kubernetes Service Not Reachable
- Lambda Cold Start Latency
- Log Volume Explosion and Cost Runaway
- Memory Leak Diagnosis
- Metrics Gaps in Dashboards
- Missing Traces in Distributed Tracing
Start free on Cariara · Coding problems · System design studio