How do you size and tune the controller JVM?
AdvancedConceptBackups, HA, upgrades & performance
Answer
Set heap explicitly (-Xms = -Xmx, or -XX:MaxRAMPercentage=75 in containers), use G1GC (default on JDK 17+), enable GC logging and heap dumps on OOM:
JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:+UseG1GC -XX:+UseStringDeduplication \
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/jenkins_home/heapdumps \
-Xlog:gc*:file=/var/jenkins_home/logs/gc.log:time,uptime:filecount=5,filesize=20m"
Typical controllers need 4–16 GB heap depending on job count, build retention and concurrent pipelines. Growing beyond that usually signals too much on one controller.
More on Backups, HA, upgrades & performance
What do you back up in Jenkins and what do you exclude?IntermediateHow do you back up Jenkins running on Kubernetes?IntermediateDoes Jenkins support active-active high availability?AdvancedHow do you plan a Jenkins LTS upgrade?IntermediateWhat does "Manage Old Data" mean after an upgrade?BeginnerWhat are the most common causes of a slow Jenkins controller?Intermediate