- Best Practice For Java Heap settings
- CloudBees Core on Modern Platforms
- CloudBees Core on Traditional Platforms
- CloudBees Jenkins Distribution
- CloudBees Jenkins Team (CJT)
- CloudBees Jenkins Platform - Client Master (CJP-CM)
- CloudBees Jenkins Platform - Operations Center (CJP-OC)
- CloudBees Jenkins Enterprise (CJE)
- Jenkins LTS
A. According to Oracle JVM ergonomic page, the maximum heap size should be be 1/4 of the physical memory. This threshold is also extended when Jenkins is running inside a VM and/or Docker Container (maximum heap size limits are aggregated when there are more than one Java application running on the same host).
B. Set your minimum heap size (
-Xms) to the same value as maximum size (
-Xmx). As a JVM Administrator, you should know the needs of the application based on current usage if you are following Best Practices and collecting Garbage Collection logs. If you need assistance with analyzing your GC logs, please submit a support ticket.
C. Jenkins should not be started with less than
-Xmx2g. However, no more than
-Xmx16g should be allocated to heap per our Best Practices and horizontal scaling should be employed.
If your instance is not able to support its current workload (due to number of jobs and dynamic configurations) you should consider scaling horizontally your infrastructure by adding more masters to divide the workload more efficiently.
D. The Jenkins Monitoring Plugin can be installed to monitor the performance of your instance, the right heap value should be a value between 80-90% of total heap consumption when the instance is at the maximum workload. Increased heap memory will produce long Garbage Collection pauses, which can be observed via slowness in the UI and sometimes even side effects like agent disconnections.