Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails app starts very slowly in Heroku

I have a Rails app hosted in Heroku. If I go the the site for the first time, it takes more than 10 seconds to start the app. After that, everything works fine and fast.

What should I do to boost first time loading? Should I add more Web Dynos, or more Worker Dynos, or do something with my configuration?

Thank you.

like image 735
AdamNYC Avatar asked Dec 13 '22 03:12

AdamNYC


2 Answers

If you are on the free Heroku 1 dyno setup then the dyno will wind down after 1 hour of inactivity.

Should you pay for 1 or more extra dynos then none of you dynos will wind down and you will only ever face the bootup time when you push a new version.

You can choose to install the free New Relic add-on, and you can set this to ping your app every 2 minutes. This will stop it spinning down. http://addons.heroku.com/newrelic

like image 158
michaelward82 Avatar answered Dec 21 '22 20:12

michaelward82


Heroku unloads your app from memory if it is inactive for a while. See this answer for some suggestions: Why are my basic Heroku apps taking two seconds to load?

like image 40
mikewilliamson Avatar answered Dec 21 '22 19:12

mikewilliamson