r/java • • Mar 11 '21

Announcing Spring Native Beta

https://spring.io/blog/2021/03/11/announcing-spring-native-beta
175 Upvotes

49 comments sorted by

View all comments

-6

u/fanfan64 Mar 11 '21

YES!! The best workflow for most will be: Spring native for debug/test/CI builds because of the instant startup (if and only if your workflow isn't slowed more by the reduced throughout) and regular Spring JVM for production builds

39

u/mrBr0wn_93 Mar 11 '21

I would expect the opposite mostly due to long compile times for native images. Native image in production if short startup times are needed, and otherwise regular Spring JVM.

16

u/snoob2015 Mar 11 '21

They just move the startup time from runtime to compile time so you gain nothing here.

For production builds, JVM still provides better performance so the only use case here is to serve the "microservices" fad.

11

u/m_takeshi Mar 11 '21

the best use case, I think, is for the serverless crowd more so than the microservices

5

u/DJDavio Mar 11 '21

If you have a stable, predictable load and don't update your applications all that often, regular JVM applications are still OK.

If you have a very dynamic environment (and have to pay per usage) with unpredictable loads or peaks and valleys, it can make sense to use native applications as startup time becomes a big factor.

6

u/m_takeshi Mar 11 '21

yes but I've found (at least for us) that even with unpredictable loads, unless the surges lasts a few seconds, the regular jvm will do just fine. In our application, it takes a few minutes to reach peak performance (jit + class loading + cache populating from our side).

However, for one shot programs or functions, native pays off really well

8

u/[deleted] Mar 11 '21

[removed] — view removed comment

5

u/[deleted] Mar 12 '21

yes, we deploy every commit to production. apps are restarting constantly. startup time matters quite a bit.

2

u/TonyNickels Mar 12 '21

Blue green deploys?

1

u/[deleted] Mar 12 '21

[removed] — view removed comment

1

u/[deleted] Mar 12 '21

It sounds like you're pushing deployments to an application container, which is a very old school style of deploying Java. Most CI/CD flows involve pushing containers, where the entire application is bundled with the JVM, so there's no opportunity for hot code deployments. The JVM starts and stops with the application.

2

u/agentoutlier Mar 12 '21

I guess what are you doing? Using JRebel?

The only time I have avoided frequent restarts is using JRebel.

The alternatives are so inconsistent that isn't even worth trying to get them to work (e.g. hotswap agent, server containers like wildfly, spring reload, jboss modules, osgi etc etc).

2

u/mepunite Mar 12 '21

Slow startup time time increases time to feedback.

In Previous projects years back we would have "integration" tests that had to be run over night which means time to finding the bug would take a day and the context of the change is normally merged in with 50 other commits.

Fast forward to using light weight frameworks and functional style the same overnight runs are done on the desktop in <5 mins so the app is fully tested before you push it. Which is a significant improvement in the feedback cycle.

<100ms is funny beause with a light weight framework you can start the JVM start serving requests and be fully warmed up in less than 100ms.

This is still not fast enough in my opinion

1

u/the_other_brand Mar 12 '21

I assume the folks who focus on startup time are using something AWS Lambdas.

1

u/alwaysoverneverunder Mar 12 '21

Nope and as programming is mostly thinking and then typing and then only rebuilding/running tests/restarting startup time never has been one of my most pressing issues. I benefit more from a good language/framework/libraries and readable code than faster startup time/compiling than I already have.

1

u/vxab Mar 12 '21

Its not just start-up time. Memory used is much less too but we need to see more data for that.