Some time ago, I realized that Spring Boot applications on my Macbook Pro (i7, 16GB RAM) start really slow – basic ones, just after generation in Spring Initializr, about 12 sec. I tested the same application on my Windows PC (i7, 16GBRAM) and the result was about 1,5 sec. What made such a big difference? It turned out that it’s known problem with DNS.

The problem

I found this ISSUE on Intellij bugtracker. There is a problem with DNS server, especially with resolving IP address of your Mac’s HOSTNAME. It causes host resolution hangs until it times out.

The solution

Solution is pretty simple, you need to check your /etc/hosts file. Make sure that your HOSTNAME points to 127.0.0.1, e.g.:

To get your HOSTNAME simply run this command

After introducing this simple fix now I’m waiting only about 2 secs for application startup.

Please follow and like my blog:
Author