Jenkins

Excessive Garbage Collection from Suboptimal JVM Settings

warning
Resource ContentionUpdated Oct 17, 2024

High GC activity degrades Jenkins performance when heap size is insufficient or GC algorithm is poorly configured for Jenkins workload patterns, causing pauses and slowdowns.

How to detect:

Monitor GC time percentage and GC pause duration. Alert when GC time exceeds 10% of total CPU time or individual GC pauses exceed 1 second. Track Old Gen heap usage approaching max capacity.

Recommended action:

Tune JVM flags: use -Xms and -Xmx (minimum 2GB for production). For Java 8+, configure -XX:MaxMetaspaceSize instead of -XX:MaxPermSize. Enable GC logging with -XX:+HeapDumpOnOutOfMemoryError. Consider G1GC for large heaps. Monitor and adjust based on workload.