The scope of this project is to compare execution time for an application executed with JVM vs compiled to a native image using GraalVM. Project contains a simple Spring Boot application with one Controller + one endpoint.
- SKDMan should be installed
sdk install java 20.3.0.r11-grlsdk use java 20.3.0.r11-grlgu install native-image
- Execute
./build.sh - Exercise application (it will generate insights for native image builder in
src/main/resources/META-INF/native-image) - Stop application with
Ctrl+^C - execute
mvn -Pgraal clean package - execute generated binary from `./target
This application executed with JVM took ~3.5s to start, when native-image was created, it took ~70ms to start.
Building a native-image is a relatively expensive operation, it takes about 2:30m on my machine and about around 8Gb of memory.
https://www.graalvm.org/reference-manual/native-image/
https://spring.io/blog/2020/06/10/the-path-towards-spring-boot-native-applications