- This repository was created to perform a test comparing the startup time between a standard spring boot microservice project, and a microservice project using Spring Native (https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/).
- Gradle 7.0.2
- jdk 21.1.0.r11-grl (OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05))
- spring-boot-starter-webflux
- spring-native
Two sub-projects were created to separate the logic:
- spring-native-microservice sub-project:
Microservice project contains the Spring-Native setup to run this application on a GraalVM Native Image through Docker container - standard-microservice sub-project:
Simple microservice project using spring-boot-starter-webflux
Both projects contain only one controller class with the same content just to test purpose:
@RestController
@RequestMapping("/user")
public class UserController {
@GetMapping("/getName")
public Mono<String> getName() {
return Mono.just("Ragnar Lothbrok (Vikings)");
}
}
There is a README.md file inside each sub-projects describing how to run them.
It was pretty straightforward. To perform the startup time test, I ran both subprojects as described in the README.md file, and the results were amazing. Take a look below :)
- The startup time of the microservice project using Spring Native running on Native Image was ~17x faster than a standard microservice project running on HotSpot JVM.
The Spring team is doing a great job related to Spring Native.
This plugin came to compete with Micronaut and Quarkus, but I believe that the Spring team has a lot of work to do to release a version more trustful. I say that because in this simple POC, I faced many warnings and errors during the docker image build (maybe I forgot to set up something).
Anyways, congratulations Spring team!!!!! I'm impressed with the results and looking forward to testing new releases. \o/