Speeding up Play application startup Subscribe Pub Share

So I had this issue for a while, where starting my Play app on one of my Digital Ocean VM was very slow... it used to be stuck after configuring the logs.

I finally had some time to look into it today and managed to reduce the startup time to close to nothing. It was some DNS thing again...

Upon startup, the MongoDB ObjectId apparently uses the local IP address or something and the stack trace clearly indicated that the DNS lookup from Java was slow. After some googling, the culprit was the actual DNS server.

Anyways - long story short, make sure the Google DNS is first in the /etc/resolv.conf file:

You can certainly edit it - you should in fact. The 4.2.2.2 was my first in the list on that box and simply by putting it last, the startup became instant.

cat << EOF >> /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 4.2.2.2
EOF

I have no clue why this box was setup differently, but it was.


Was this useful?    

By: Razie | 2014-10-29 .. 2016-05-16 | Tags: post , scala , play , programming , devops


See more in: Cool Scala Subscribe

Viewed 1632 times ( | History | Print ) this page.

You need to log in to post a comment!