This repository is designed to demonstrate how to improve Spring Boot applications efficiency and performances by upgrading from Spring Boot 2 / Java 8 to Spring Boot 3 / Java 21. This migration is done step by step and intermediate benchmarks can be performed.
If SDKMAN! is installed:
sdk env installA recent version of Docker, Docker Compose should be installed.
Oha should be installed for benchmarks.
If SDKMAN! is installed:
sdk envTo build the container image:
./build-container-image.shTo run the application:
docker-compose upmainis leveraging Spring Boot 3.3+ executable JAR self-extracting capabilities and Dockerfiles.buildpacksis leveraging Paketo Buildpacks CDS and Spring AOT support.premainis leveraging Project Leydenpremainexperimental branch.
By default, benchmarks are done with 2 CPUs and 2G RAM in order to emulate a cheap Cloud instance (see related
configuration in the docker-compose.yml file. Oha is used to benchmarks web endpoints with a 60s warmup and a 30s benchmark.
To benchmark a Thymeleaf template that is using cached data, run:
oha -z60s http://localhost:8080/vets.html && oha -z30s http://localhost:8080/vets.htmlTo benchmark a REST endpoint with JSON serialization using cached data, run:
oha -z60s http://localhost:8080/vets && oha -z30s http://localhost:8080/vetsTo benchmark a Thymeleaf template that is using data retrieved by Spring Data JDBC, comment the @Cacheable("vets") annotation in VetRepository, rebuild and restart the container, then run:
oha -z60s http://localhost:8080/vets.html && oha -z30s http://localhost:8080/vets.htmlTo benchmark static resources, run:
oha -z60s http://localhost:8080/resources/images/spring-logo.png && oha -z30s http://localhost:8080/resources/images/spring-logo.png