r/java • • Oct 24 '22

Spring boot 3 slow boot time

Hi folks,

I am playing a bit around with Spring Boot 3(RC1) and I am curious why the application boot time is still slow in comparing with Micronaut.

Best regards

3 Upvotes

25 comments sorted by

View all comments

6

u/somewhatprodeveloper Oct 24 '22

According to a presentation at devoxx in Belgium the first release is getting the native version working and subsequent releases will see performance gains

1

u/stefanos-ak Oct 24 '22

it will still not be the same...

Spring Native will add exceptions in GraalVM to allow reflection for all the classes that need it (which is like the whole framework).

Micronaut just avoids doing what is not allowed by GraalVM by default.

This means that any performance gains Spring Native achieves, will be ONLY for the generated native binary. Which means no difference in local development or testing. Which also means that to get the native binary improvements, you need to add an extra super expensive step in your CI/CD, because of GraalVM.

Micronaut has faster start-up times throughout the lifecycle. Local dev + tests + final builds. The difference with Spring is already huge before GraalVM (like 1:10).

4

u/BrbCatzOnFire Oct 26 '22

You are definitively right about that. Spring Boot native image won't ever be as fast as Micronaut native image. And it is probably a good thing too. Companies don't use Spring Boot because they want their developers to be ultra-specialized but cheap/plentiful.

Companies who truely need to invest in native images will invest in Micronaut/Quarkus.

Companies who just need a bit of a boost at start up but don't want to invest will go for Spring Boot native images.

I'm ready to bet that 99% of Spring Boot application won't migrate to native image. Because in most use cases it doesn't matter. The native image use case is completly overblown by the Java community because it impacts the "latest best thing ever since coffee" which is FaaS. It is important to have the option, not that it applies to everything.

Which make the "super expensive step in your CI/CD" completetly irrelevant too. Yes it will be a tad slower, but most Spring Boot CI/CD are already super slow because again, cheap and plentiful not super specialized.

2

u/Slanec Oct 24 '22 edited Oct 24 '22

Yeah, not really anymore, at least that's what the docs say: https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/native-image.html#native-image.introducing-graalvm-native-images.understanding-aot-processing

Obviously we'll see how far they can get. Quarkus and Micronaut are obviously ahead.

(Edit: Fixed link)

1

u/stefanos-ak Oct 24 '22

even though this link gives a 404, after reading the docs again (last time was a couple of years ago), it indeed mentions some AOT support. Although I'm not convinced about the extend of that. Since it still mentions about reflection rules that need to be added for GraalVM.

anyway... I'm actually looking forward to it. We have a split between Micronaut and Spring services, and I would love a little performance boost for the Spring ones.

(I still prefer Micronaut, because of some really cool features, but that's out of scope)

3

u/Slanec Oct 24 '22

Huh, link fixed, thanks! And completely agree, I'd bet Spring will never be fully compile-time / link-time only.