awesome java apps with GraalVM and Java microservices frameworks

Abstract

Demos on multiple frameworks to use GraalVM native images

  • spring framework
  • micronaute
  • helidon
  • quarkus Native image is natively supported by JUnit 5. We can compress native images with UPX.

Drawbacks:

  • required build time step
    • computational effort necessary at build time
    • need a powerful machine with the same target architecture & OS
    • develop in JIT for fast development, only use AOT for final deployment
    • for best throughput, use profile-guided optimizations:
      • native-image --pgo-instrument MyMainClass ./mymainclass
      • native-image --pgo=profile.ipfrof MyMainClass ./mymainclass
  • GraalVM & Reflection
    • native image tries to resolve the target elements through a static analysis that detects calls to the Reflection API
    • easier way to handle reflection: use the following configuration in the native-maven-plugin:
<plugin>
  <groupId>org.graalvm.buildtools</groupId>
  <artifactId>native-maven-plugin</artifactId>
  <extensions>true</extensions>
  <executions>
    <execution>
      <id>build-native</id>
      <goals><goal>compile-no-fork</goal></goals>
      <phase>package</phase>
    </execution>
  </executions>
  <configuration>
    <metaRepository>
      <enabled>true</enabled>
    </metaRepository>
  <configuration>
</plugin>