java module system
play

Java Module System How to decrease your application footprint - PowerPoint PPT Presentation

Java Module System How to decrease your application footprint Leonardo Zanivan - Crossover Rodrigo Cndido da Silva - Integritas Java 9 Modules System Previous Module System Classpath After Module System Classpath JDK 9+ Spring Modules jlink


  1. Java Module System How to decrease your application footprint Leonardo Zanivan - Crossover Rodrigo Cândido da Silva - Integritas

  2. Java 9 Modules System

  3. Previous Module System Classpath

  4. After Module System Classpath JDK 9+

  5. Spring Modules

  6. jlink exec

  7. Migrating Spring PetClinic to Java 9 Modules Spring Boot 2 sample application with REST MVC & JPA ● 1. Create module-info.java with all the required imports 2. Update third party libs with JDK 9/10 fixes 3. Add new Maven plugin to copy dependencies 4. No Java code change was required

  8. Lessons Learned Application can still run with explicit classpath after migration ● Use --upgrade-module-path to override problematic modules ● You will find that third party libs are not ready to use modules ●

  9. Lessons Learned Automatic modules can cause issues (naming conflicts, JLink) ● e.g: JLink was used to create a minimal JRE manually ○ Third party libs may require you to open some packages ● e.g: Hibernate JPA, Spring ○ Hello World always work! � ●

  10. JDK 10 Highlights Support for Linux only Can extract Docker container-specific Attaching to namespace awareness information about number issue(s) have been resolved! of CPUs (automatically) JDK-8146115 enhancement JDK-8186309 enhancement host PID ⇒ container PID JDK-8179498 enhancement Can extract container-specific New JVM flags for Docker support: information about (default) -XX:UseContainerSupport allocated memory -XX:ActiveProcessorCount (automatically) -XX:InitialRAMPercentage -XX:MaxRAMPercentage -XX:MinRAMPercentage

  11. JDK 10 Highlights JEP 310 : Reduce resource Application footprint when multiple JVMs were Class-Data running on the same physical machine Sharing Improve Pre-Java 10 , use of CDS had startup time been restricted to the Processes/applications can sharing of application bootstrap class loader only common class metadata (class-data), from a shared archive ( CDS archive )

  12. JDK 11 Changes java.xml.ws (JAX-WS) ● java.xml.bind (JAXB) ● JEP 320 : java.activation (JAF) ● Remove Java EE java.xml.ws.annotation (JSR 250) ● and CORBA java.corba (CORBA) ● Modules java.transaction (JTA) ● java.se.ee (Aggregator module) ● jdk.xml.ws (Tools for JAX-WS) ● jdk.xml.bind (Tools for JAXB) ●

  13. Eclipse OpenJ9 TL;DR; 2x smaller memory ● footprint and starts 2x faster than HotSpot. Experimental; AdoptOpenJDK ● builds are available. https://adoptopenjdk.net

  14. github.com/panga/qcon2018-java9modules

  15. JDK 10 Minimal JRE + Module Application < 100mb Note: JDK 10 Alpine was built from source: https://hub.docker.com/r/panga/openjdk10/

  16. JDK 10 Modules starts 2x faster on Docker Note: Best case scenario during my tests. Limit: 2 cpus, 1g memory, JVM_OPTS= Xmx512m

  17. JDK 10 Modules has 2x lower footprint on Startup! Note: Best case scenario during my tests. JMeter test plan was used to load application.

  18. JDK 10 Modules has 2x lower footprint after Load! Note: Best case scenario during my tests. JMeter test plan was used to load application.

  19. github.com/panga/spring-petclinic-java9modules

  20. @leonardopanga @rcandidosilva http://jav.mn/java10

Recommend


More recommend