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?
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.”