While you are reading these lines, there are a few hundreds of Spring Boot applications struggling to load a JVM and start.
Yet others are up and running but consuming a huge amount of memory since a JVM needs to be underlying - supporting the application on top.
And adding this latency and resource consumption to a more Cloud Native world is just something that... It's NOT a match!
Some developers just abandoned the idea of using Spring Boot in a world conquered by containers. And they moved far to those battles with Golang. Others stayed with Java, but in another flavour, like Quarkus or Micronaut (i.e. GraalVM powered).
But in March 2021, something happened in the community of Spring Boot users, and that was the release of the beta program of Spring Native.
Why? Spring Boot applications can be now be compiled using GraalVM. I.e., it can be compiled to native code.
- Image size for an example project can go from ~170MB to ~60MB
- RAM memory consumption can go from ~172MB to ~30MB
- Start-up times can go from 2 seconds to 70 milliseconds
I've written a small example that you can take a look and comment on that 🙂
🚀 Bookend: Spring Native Starter app
- Example Spring Boot REST application using Spring Native
- Spring Boot, Java 11, Lombok
Provided a comparison between JVM image build and GraalVM image build.
Create the image locally
./mvnw clean spring-boot:build-image
Running the just created local image
docker run --rm -p 8080:8080 bookend-native:0.0.1-SNAPSHOT
And if you are Spanish, I've explained all this in a more multimedia format:
Thanks for reading. I appreciate your comments ❤️.