0

I'm trying to figure out ways to improve the restart time of my Spring Boot application when using spring-boot-devtools and see that there's consistently a ~5 second delay between these logs lines:

2022-07-03 14:35:28.602 DEBUG 82357 --- [     Thread-165] o.s.boot.devtools.restart.Restarter      : Starting application ...

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)

2022-07-03 14:35:33.697  INFO 82357 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888

I've set the root log level to TRACE, but still see nothing for those 5 seconds. What's happening in that time and is there anything that can be done to speed it up?

mowwwalker
  • 16,634
  • 25
  • 104
  • 157

1 Answers1

0

I got lucky and found the underlying issue with a hailmary generic Google search for 5 second JVM delay which led me to https://github.com/netty/netty/issues/8993

The issue and solution are described here: Jvm takes a long time to resolve ip-address for localhost

That answer has more info, but in short, the fix is:

  1. hostname -> eg Monroes-MacBook-Pro.local
  2. sudo vim /etc/hosts
  3. add
127.0.0.1 Monroes-MacBook-Pro.local
::1 Monroes-MacBook-Pro.local

Related pages:

mowwwalker
  • 16,634
  • 25
  • 104
  • 157