Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy way to prevent Heroku idling?

Tags:

heroku

In the Heroku free apps the dynos seem to keep idling - my app has very low traffic but it's also not really acceptable in my case that my users have to wait 20+ seconds to spin up a new dyno.

Frankly, with that kind of wait, many will leave before the first page even displays.

So, I have a problem: should I be paying $36 a month to save each user an embarrassingly long 20 seconds when my traffic is in the single-digits per day.

Is there a way around this??

like image 757
sscirrus Avatar asked Mar 29 '11 23:03

sscirrus


People also ask

How do you keep your free Heroku app online forever?

Staying Up Forever All you need to do is input the URL of your Heroku app and leave the “I want a bedtime!” box unchecked.

How long does Heroku app take to go to sleep?

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.

How do you get 1000 Dyno hours on Heroku?

How are free dyno hours calculated? Personal accounts are given a base of 550 free dyno hours each month. An additional 450 free dyno hours is available for all accounts verified with a credit card for a total of 1000 hours per month.

Is Heroku online 24 7?

Starting today, Heroku accounts have an account-based pool of free dyno hours for use on free apps. This replaces the 18 hours a day limit on free apps, allowing a free app to run 24/7 if needed. New accounts receive 550 free dyno hours and you can verify your identity with a credit card for an additional 450 hours.


2 Answers

You can install the free New Relic add-on. It has an availability monitor feature that will ping your site twice per minute, thus preventing the dyno from idling.

More or less the same solution as Jesse but maybe more integrated to Heroku... And with a few perks (performance monitoring is just great).

Availability monitoring

Note: to all those saying it doesn't work: the important part in my answer is "availability monitor". Just installing the addon won't help. You also need to setup the availability monitoring with the URL of your heroku app.

like image 52
Pierre Avatar answered Nov 22 '22 16:11

Pierre


As an alternative to Pingdom I suggest trying Uptimerobot. It is free and offers 5 min interval site checking. It works very fine for me.

UPDATE 7th of May 2015: This will not be possible any more, as Heroku will change their free dyno to prevent keeping it alive for full 24 hours:

Another important change has to do with dyno sleeping, or ‘idling’. While non-paid apps have always slept after an activity timeout, some apps used automatic pinging services to prevent that behavior. free dynos are allowed 18 hours awake per 24 hour period, and over the next few weeks we will begin to notify users of apps that exceed that limit. With the introduction of the hobby dyno ($7 per month), we are asking to either let your app sleep after time out, or upgrade to this new option.

When is this going to be live? According to their blog post:

Applications running a single 1X dyno that don’t accumulate any other dyno charges will be migrated gradually to the new free dynos beginning on July 1.

like image 20
Cristian Avatar answered Nov 22 '22 14:11

Cristian