Java11 upgrade - experience and notes

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