Best options and bonus advantages for developers (while upgrading to Java 11):

  • Minimum best option- When upgrading to JDK 11 (LTS) for spring boot applications please consider using the OpenJ9 JRE to help reduce the memory required.
    • change openjdk:8-jre-slim →  adoptopenjdk/openjdk11-openj9:alpine-jre
  • Minimum second option - if you have binary dependencies that will not work with alpine. Please only use this if you have exhausted all of the instructions about how to convert to alpine.
    • change openjdk:8-jre-slim →  adoptopenjdk/openjdk11-openj9:jre
  • Bonus - Make sure you allow for JAVA_OPTS environment to be passed into your jvm startup to allow for things such as remote debugging.
  • Bonus - Setup docker layers to allow for smaller docker image updates – the youtube video adds this so you can just push your modified application layer vs all the jars again for java class changes.
  • Bonus - if you don't need spring boot or jvm remove jvm/spring boot from your micro service.

---------Upgrade issues and tips------

When migrating from Java8 to Java 11 – some maven issues were found and there are tips in this page. https://winterbe.com/posts/2018/08/29/migrate-maven-projects-to-java-11-jigsaw/

Great video by the OpenJ9 folks https://www.youtube.com/watch?v=LmmwtquTpQs

---------optimization tests-----------

Size and memory footprint optimization that is observed:

  • Docker image size: 342MB -> 275MB - ~20% reduction in size
  • Memory: 410MB → 241MB using OpenJ9 11
  • No labels

2 Comments

  1. Most developers are using OpenJDK - what is the impact of using adoptopenjdk alpine instead of an openjdk alpine ?

    1. Hi Brian Freeman , we did not see any negative impacts using adoptopenjdk. However, we have seen huge benefits - Low memory footprint, Fast startup time, High application throughput, Smoother ramp-up in the cloud (as claimed by https://www.eclipse.org/openj9/). 

      The adoptopenjdk are just builds of openjdk and openj9 r/https://github.com/AdoptOpenJDK - also has support for LTS-marked versions (like Java 11 LTS) for longer.

      The main motivation for us to explore the openj9 based base java images is due to the most common question we always hear from various users of Portal - "Why are the ONAP artifacts so huge? are there any slimmer versions? that can also perform better when starting up the java webapps?".