Back to blog

Java JVM Updates and Memory Improvements in Jenkins

Mark Schulz
May 8, 2026 ⏱︎ 3 min read

In this post, we share our experience upgrading Jenkins from Java 17 to Java 21 and the impact this had on memory usage. After the move, we observed a reduction in out-of-the-field memory consumption from a monthly mean of 33–34 GB down to 28 GB. This improvement helped us reduce operational pressure and improve overall efficiency in our Jenkins environment.

Why we upgraded to Java 21

Java 17 served us well as a stable long-term support release, but as part of our ongoing platform modernization, we evaluated Java 21 for Jenkins. Our goals were simple:

  • benefit from the latest JVM performance improvements

  • reduce memory footprint

  • follow the platform recommendation

Java upgrades in production systems are never just about version numbers. They are about measurable operational outcomes. For us, memory usage was one of the most important signals.

What we observed

After moving from Java 17 to Java 21, we tracked memory usage in our production environment and compared the results over time. We made use of the Jenkins monitoring plugin based on Java melody. 2026 05 08 JVM upgrade January to April diff

The result was clear:

  • Before the upgrade: monthly mean memory usage of roughly 33–34 GB

  • After the upgrade: monthly mean memory usage of roughly 28 GB

That is a meaningful reduction of approximately 5–6 GB, or around 15–18% depending on the baseline.

Why memory improved

We did not make a single code-level change to achieve this reduction. The main driver was the JVM change itself.

Java 21 includes a number of runtime and garbage collection improvements that can positively affect memory behavior, especially in long-running server applications like Jenkins. While the exact impact depends on workload and configuration, the following areas are commonly relevant:

  • improved garbage collection behavior

  • runtime optimizations in the JVM

In our case, the upgrade improved the memory usage in our production environment significantly.

Preparation for bigger updates

  1. Measure before and after. Establish a baseline with monitoring data before the upgrade, then compare metrics after the upgrade to validate improvements.

Recommendation

If you are currently running Jenkins on Java 17, it is worth your time to evaluate the latest LTS update and Java 21. You may see improvements in performance, stability, and memory efficiency, depending on your workload and configuration.

Conclusion

Upgrading from Java 17 to Java 21 delivered a noticeable improvement in Jenkins memory usage for our environment. We saw a reduction from 33–34 GB to a monthly mean of 28 GB without requiring application-level changes.

System information

  • more than 10000 daily builds

  • more than 1000 active users

  • more than 100 connected agents

About the author

Mark Schulz

In my day job, I’m a DevOps engineer in a central team that provides Jenkins and other DevOps tooling.

Discuss