Keeping Your Heroku Dyno Awake
Posted on September 20, 2012 • 2 minutes • 265 words
Apps that have scaled the number of web dynos (dynos running the web process type) so that only a single web dyno is running, will have that web dyno idled out after one hour of inactivity. When this happens, you’ll see the following in your logs:
2011-05-30T19:11:09+00:00 heroku[web.1]: Idling 2011-05-30T19:11:17+00:00 heroku[web.1]: Stopping process with SIGTERM
When you access the app in your web browser or by some other means of sending an HTTP request, the routing mesh will signal the dyno manifold to unidle (or “wake up”) your dyno to run the web process type:
2011-05-30T22:17:43+00:00 heroku[web.1]: Unidling
2011-05-30T22:17:43+00:00 heroku[web.1]: State changed from created to starting
This causes a few second delay for this first request. Subsequent requests will perform normally.
Apps that have more than 1 web dyno running are never idled out. Workers dynos are never idled out.
##The Good News Overcome this nuisance by touching the site at least every hour so that the dyno doesn’t have time to begin idling.
You can sign up for a service provider, free at Pingdom, that will ping your application at designated intervals.
Ping is a network protocol that sends ICMP echo request packets to the target host and waits for a response.
Pingdom is loaded with features; including availability to a public page to view when the last time your host was checked, alerts via email or SMS, and many other features.
I chose to sample Pingdom because it affords the least amount of work in setting up at a free price. Please post any alternatives you can think of in the comments below.