Azul Zulu OpenJDK 15 on Raspberry Pi

Avatar
Frank Delporte

Frank Delporte (@frankdelporte) is a Java developer, blogger, author of "Getting started with Java on Raspberry Pi", and contributor to Pi4J. Frank blogs about his experiments with Java, sometimes combined with electronic components, on the Raspberry Pi.

For this post I did some experiments with Java 15, reusing the Ubuntu 64bit SD card which was also used for my earlier post "Startup Speed of Spring and Quarkus JARs on the Raspberry Pi".

That version of Ubuntu comes with OpenJDK 11 pre-installed.

$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode)

Installing Azul Zulu OpenJDK 15

OpenJDK Java 15 was released on 2020-09-15, check out the Java Version Almanac for more details.

Immediately after that, Azul released Azul Zulu OpenJDK 15, including a new version of their free Zulu Embedded JDK, including a version for ARM 64-bit, which is ideal for the latest Raspberry Pi boards!

With the SDKMAN tool, you can get a list of available JDKs on your Raspberry Pi and switch to Java 15 with a single command: sdk install java 15.0.0-zulu.

$ sdk list java

================================================================================
Available Java Versions
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 AdoptOpenJDK  |     | 11.0.8.hs    | adpt    |            | 11.0.8.hs-adpt      
               |     | 8.0.252.hs   | adpt    |            | 8.0.252.hs-adpt     
 Amazon        |     | 11.0.8       | amzn    |            | 11.0.8-amzn         
               |     | 8.0.262      | amzn    |            | 8.0.262-amzn        
 Azul Zulu     |     | 15.0.0       | zulu    |            | 15.0.0-zulu         
 BellSoft      |     | 14.0.2.fx    | librca  |            | 14.0.2.fx-librca    
               |     | 14.0.2       | librca  |            | 14.0.2-librca       
               |     | 11.0.8.fx    | librca  |            | 11.0.8.fx-librca    
               |     | 11.0.8       | librca  |            | 11.0.8-librca       
               |     | 8.0.265      | librca  |            | 8.0.265-librca      
 Java.net      |     | 16.ea.15     | open    |            | 16.ea.15-open       
               |     | 15           | open    |            | 15-open             
================================================================================
Use the Identifier for installation:

    $ sdk install java 11.0.3.hs-adpt
================================================================================

$ sdk install java 15.0.0-zulu

$ java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment Zulu15.27+17-CA (build 15+36)
OpenJDK 64-Bit Server VM Zulu15.27+17-CA (build 15+36, mixed mode)

Comparing Startup Speeds

To compare the startup speeds, I reused the Spring and Quarkus applications of the previous article.

$ cd JavaOnRaspberryPi/Chapter_10_Spring/java-spring-rest-db/target/
$ java -jar java-spring-rest-db-0.0.1-SNAPSHOT.jar
$ cd JavaQuarkusRestDb/target/
$ java -jar javaquarkusrestdb-1.0-SNAPSHOT-runner.jar

Startup Results

No important differences here, the newer JDK doesn’t seem to have any influence here.

JDKRunSpringQuarkus
OpenJDK 11137s10s
237s9s
338s10s
Azul Zulu 15139s10s
236s10s
337s10s

Thread and Memory Analysis with VisualVM

Let’s go a step deeper and use VisualVM to inspect the application.

I installed this on my Ubuntu PC with sudo apt install visualvm and extended the startup commands on the Raspberry Pi so a connection can be made from another PC.

$ java -Dcom.sun.management.jmxremote \
       -Dcom.sun.management.jmxremote.port=9010 \
       -Dcom.sun.management.jmxremote.local.only=false \
       -Dcom.sun.management.jmxremote.authenticate=false \
       -Dcom.sun.management.jmxremote.ssl=false \
       -jar javaquarkusrestdb-1.0-SNAPSHOT-runner.jar

I waited two minutes before taking each screenshot below.

Profiling Conclusions

FrameworkJDKRunning CPUHeap SizeLoaded classes
SpringOpenJDK 11< 20%132 MB13316
SpringZulu 15< 10%157 MB13200
QuarkusOpenJDK 11< 10%90 MB7463
QuarkusZulu 15< 10%50 MB7368

Quarkus seems to need less memory on Java 15 and both Spring and Quarkus have a bit less loaded classes.

Conclusion

Do you need to switch from OpenJDK 11 to 15? No, not really, based on these results.

But each new version has bug and security fixes, new features, and generic improvements:

Click here to see all the details and vote on your favorite new features and fixes!

Topics:

Don’t Forget to Share This Post!

Comments (0)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Related Articles

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard