Core Java

How much faster is Java 15?

Java 15 was released on the 15th of September 2020 and has promised to bring with it a few performance tweaks in its G1GC and ParallelGC garbage collectors.

What does it mean for OptaPlanner? Are there any benefits to be gained from upgrading from JDK11 to JDK15? In 2019, we found out that ParallelGC works better for OptaPlanner. Is that still the case a year later? Let’s put it to the test!

This article is a follow up on our Java 11 and our Java 8 performance comparison benchmarks.

Benchmark methodology

To run the benchmark we used:

  • A stable machine without any other computational demanding processes running and with Intel® Xeon® Silver 4116 @ 2.1 GHz (12 cores total / 24 threads) and 128 GiB RAM memory, running RHEL 8 x86_64.
  • Both G1 and Parallel GC for both Java versions to compare the impact of garbage collection. Executed org.optaplanner.examples.app.GeneralOptaPlannerBenchmarkApp with the parameters -Xmx3840M -server -XX:+UseG1GC and -Xmx3840M -server -XX:+UseParallelGC respectively. The results presented in this blog represent the average values taken from 10 iterations of each garbage collector and JDK combination.
  • Both OpenJDK 11 version “11.0.6” OpenJDK Runtime Environment 18.9 (build 11.0.6+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.6+10-LTS, mixed mode)
  • Both OpenJDK 15 version “15.0.1” OpenJDK Runtime Environment 18.9 (build 15.0.1+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 15.0.1+9-LTS, mixed mode)
  • OptaPlanner 7.44.0.Final
  • Solving a planning problem involves no IO (except a few milliseconds during startup to load the input). A single CPU is completely saturated. It constantly creates many short-lived objects, and the GC collects them afterwards.
  • Each run solves 11 planning problems with OptaPlanner. Each planning problem runs for 5 minutes and starts with a 30 second JVM warm up which is discarded.
  • The benchmarks measure the number of scores calculated per second. Higher is better. Calculating a score for a proposed planning solution is non-trivial: it involves many calculations, including checking for conflicts between every entity and every other entity.

Executive summary

With Java 15, the average improvement is 11.24% for G1 and 13.85% for Parallel GC. The difference between the two garbage collectors running on JDK 15 is 10.05% leaning in favor of Parallel GC. For more information about difference between various GC algorithms, please see the following article that compares Java garbage collectors performance.

Parallel GC remains to be the preferred GC to be used with OptaPlanner, since the throughput is still the most relevant factor when it comes to garbage collection.

Results

Java 11 vs. Java 15

 Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rosteringTraveling Tournament
JDK200c800cB1B10c7c8s2s3m1mh1nl14
JDK1171,52467,266253,03737,3465,8417,19310,6007,0622,5702,3591,806
JDK1572,28570,786285,66837,3718,40510,04912,3828,2052,9522,7301,997
Difference (in %)1.065.2312.90.0713.4216.8516.8116.1914.8615.7310.58
Average (in %)11.24
Table 1. Score calculation count per second with G1GC
 Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rosteringTraveling Tournament
JDK200c800cB1B10c7c8s2s3m1mh1nl14
JDK1176,60076,954296,10749,9376,2447,66612,3687,9042,9412,7292,090
JDK1591,13187,565301,98148,5187,3939,49613,9648,9633,5703,2942,295
Difference (in %)18.9713.791.98-2.8418.4023.8712.9013.4021.3920.709.81
Average (in %)13.85
Table 2. Score calculation count per second with ParallelGC

Parallel GC vs. G1 GC on Java 15

 Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rostering.Traveling Tournament
Garbage collector200c800cB1B10c7c8s2s3m1mh1nl14
JDK15 G1GC72,28570,786285,66837,3718,40510,04912,3828,2052,9522,7301,997
JDK15 ParallelGC91,13187,565301,98148,5187,3939,49613,9648,9633,5703,2942,295
Difference (in %)26.0719.165.4022.9710.3911.4911.338.4617.3117.1212.98
Average (in %)10.05
Table 3. Comparison of score calculation count per second on JDK15 with ParallelGC and G1GC being used

Conclusion

In conclusion, the performance gained in the JDK15 version is well worth considering regarding OptaPlanner. In addition, the preferred garbage collector to use is still ParallelGC, the performance of which is even better in comparison with G1GC than it was in our previous JDK performance comparison.

Author: Michal Tomčo – Quality engineer

Published on Java Code Geeks with permission by Geoffrey De Smet, partner at our JCG program. See the original article here: How much faster is Java 15?

Opinions expressed by Java Code Geeks contributors are their own.

Geoffrey De Smet

Geoffrey De Smet (Red Hat) is the lead and founder of OptaPlanner. Before joining Red Hat in 2010, he was formerly employed as a Java consultant, an A.I. researcher and an enterprise application project lead. He has contributed to many open source projects (such as drools, jbpm, pressgang, spring-richclient, several maven plugins, weld, arquillian, ...). Since he started OptaPlanner in 2006, he’s been passionately addicted to planning optimization.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button