Java garbage collection long pause with high 'sys' time
Environment
- Red Hat Enterprise Linux
- OpenJDK
- Oracle JDK
Issue
- A Java garbage collection is sometimes taking much longer than expected.
- Most young collections are taking hundreds of seconds, but sometimes they take 20 seconds with very high
systime. For example:
1234.830: [GC [PSYoungGen: 987488K->15360K(998400K)] 3452660K->2585790K(10470400K), 19.4339220 secs] [Times: user=0.55 sys=74.94, real=20.43 secs]
Diagnostic Steps
- Analyze gc logging with standard JVM options enabled:
https://access.redhat.com/labs/jvmconfig/ - Is there sufficent CPU to support the number of parallel collector threads?
-XX:ParallelGCThreads=#This is the default formula to compute Parallel GC Threads:(ncpus <= 8) ? ncpus : 3 + ((ncpus * 5) / 8) - Is there enough physical memory to prevent swapping? Is it a shared environment where something else could be consuming memory and causing swapping?
- Is vm.zone_reclaim_mode set to '1'?
- The following issue cause can cause intermittent long pauses: Java application periodic high latency / processing times due to NUMA page reclaim on RHEL
Product(s)
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.