I recently created my first Heroku application and I'm finding some strange behavior:
When the application hasn't been accessed in a while, I think the server shuts down. Then, if you access it, it takes about 20 seconds to start up before it responds. After this initial start up phase, it responds quickly.
Is there a way to avoid this "start up / shut down" phase?
To preserve your dyno hours from burning out or wasting, Heroku puts your app to sleep after 30 minutes of inactivity. How generous! This is what makes your app is slow to load. When your app's dyno is asleep, waking it up may take some time.
This means if your application has not served any requests for one hour, it is forced to sleep by heroku and has to wake up prior to serve a new request, which easily can take up to 30–40 seconds.
As you may have known that Heroku does not allow your app to run for more than 1 hour. When an app on Heroku has only one web dyno and that dyno doesn't receive any traffic in 1 hour, the dyno goes to sleep. When someone accesses the app, the dyno manager automatically wakes up the web dyno to run the web process type.
Yes, pay for a full-time dyno. The Heroku docs state that when you're on the free tier if your dyno is not in use for a while (30 minutes in my experience) it shuts down. It restarts the next time it receives a request.
See: http://devcenter.heroku.com/articles/dynos#frequently-asked-questions
Heroku refers to his as "Dyno Idling."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With