I just recently upgraded one of my teams Spring Boot applications from 2.1.3-RELEASE to now be 2.3.0-RELEASE, well as upgrading Hibernate versions from 5.3.6.Final to be 5.4.15.Final.
Everything went fine, however now when the application starts on the server, it takes anywhere from 800-900 seconds to start (roughly 15 minutes) when it used to only take about 30 seconds.
Something important to note, when running on localhost, with both 2.1.3 and 2.3.0, application startup was the same, about 12-15 seconds.
The slow startup issue is only encountered when deployed to the server.
I am certain the issue lies with the new version of Spring Boot, as i switched to SpringBoot 2.1.3 and left Hibernate as 5.4.15, and the startup was fast.
So, is there something that has changed in recent SpringBoot releases where I have to set a property to disable certain checks or something?
Most articles and posts I have seen said the issue was with Hibernate and to set this property spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
but i did that and it had no effect.
UPDATE:
I tried the property spring.main.lazy-initialization=true
but it had no effect on startup performance.
UPDATE 2:
I downgraded from 2.3.0 to 2.2.7 which resulted in an average of 170 second startup time, vs an average of 800 second startup times with 2.3.0. A roughly 3 minute startup time is still terrible, but, with a difference of 12 minutes with no change other than versions, I wonder if its just too ambitious to be on the latest version of Spring Boot.
Still very curious if anyone has some suggestions of why we would have gone from a 30 second start time with 2.1.3 to a 3 minute start time with 2.2.7.
Was there a major changed introduced between 2.1.x and 2.2.x?
LAST UPDATE
I tried version 2.2.5 which resulted in no decrease in startup performance from 2.1.3. If anything startup performance has increased. So, this leads me to believe something has changed under the hood with versions 2.2.6 and higher.
I am going to stick with 2.2.5, but am still hoping for an answer if anyone out there has attempted to use these most recent versions of Spring Boot.
When a Spring Boot Application has slow startup, it can be one or more beans and related dependencies taking longer to initialise and slowing down the entire process. Profiling Spring Boot application doesn't often help in diagnosing the startup issues.
What is the latest Spring Boot version? The current stable version, as of July 2022, is Spring Boot 2.7. 1.
If you can go up to Spring Boot 2.4.x there is a new Actuator endpoint called /startup which will tell you how long each initializing bean took, which should tell you what is so slow: https://medium.com/techwasti/startup-actuator-endpoint-spring-boot-54a8dd0a1fdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With