Why is Spring Boot extremely slow to start up on Mac OSX Mavericks (10.9.2)?
Asked Answered
V

2

23

I don't have any other issues with java and STS starts up fine but when I try to run my app as "Run as Spring Boot App" (or any of the samples), the console is empty for up to 5 minutes, before I get the familiar "Spring Boot" ASCII art. Then it works fine.

Vallie answered 8/5, 2014 at 20:38 Comment(2)
Wow that's bad. What if you run them from the command line? Is it any better the second time (after Maven dependencies are cached)?Krone
Happened to me too after Sierra upgrade.Lazaretto
V
79

Turns out there was an issue resolving the network host. I fixed it by executing this command from the console:

scutil --set HostName "localhost"
Vallie answered 9/5, 2014 at 17:38 Comment(10)
Wow, applying this fix took my spring-boot startup down from 60 seconds to < 3, it was driving me mad!Costa
Works great on MacOS SierraGrison
Wow this just reduced my server startup time by 30 seconds.Mercedezmerceer
Great! Could you point out the difference between setting a "real" name vs. using "localhost"?Gesso
Same... Wow.... I wonder if Springboot could add a check for this issue. Any idea why this slows it down so much?Bernini
Paul, please, how can you find out this solution? Very good. The startup time down 60 seconds to 5 seconds. Thanks!Copperas
Anyone knows why this helps? Thanks!Arredondo
Worked like a charm on Mojave. I don't know why this issue persists for such a long time.Absorption
This works also in MacOS Catalina. I've also added it to the .bash_profile so it's always set from start.Hydrops
Confirm working on Big Sur 11.5.1 (20G80). Startup time reduced from 16 seconds to 1 second.Wormwood
R
0

It must be something with you environment. You may try running the app in other IDE like Intellij. I presume it's the STS causing the problem. You may also try running it in fresh STS installation. I'm using latest OSX and Intellij and have no problems.

If you want to play around with this you could also analyse a java code dump to see what's happening inside your jvm: http://www.javacodegeeks.com/2013/02/analysing-a-java-core-dump.html

Rosmunda answered 8/5, 2014 at 21:46 Comment(1)
You might not need a core dump. A simple thread dump (from kill -3, or jstack) would probably tell you a lot.Krone

© 2022 - 2024 — McMap. All rights reserved.