Interview Prep/CI/CD/Jenkins in Production

How do you tune the Jenkins controller JVM and avoid out-of-memory crashes?

AdvancedProductionJenkins in Production
Answer

Set heap explicitly (-Xms equal to -Xmx, typically 4–16 GB, leaving OS headroom), use G1GC, and enable heap dump on OOM. The usual memory hogs: thousands of builds retained, giant build logs, plugins leaking, and too many concurrent Pipeline runs. Limit retention with buildDiscarder, avoid printing megabytes to the console, and use the Metrics/Prometheus plugin to track heap and GC.

JAVA_OPTS="-Xms4g -Xmx4g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/jenkins_home/dumps -Djenkins.install.runSetupWizard=false"
All CI/CD questions

More on Jenkins in Production