Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku - Spin Up

I have a site that I deployed to Heroku. It's a low traffic site so if nobody goes to it for a couple hours and then go to it, it will take about 5-10 seconds to load. Any other requests to other pages on that site loads up fine quickly. If I exit the site entirely and check back in a few minutes later, it also comes back up quickly.

It's only if it's left idle for a couple hours that the spin up time is noticeable. Does anyone else have this issue? If so, how did you fix it.

Also while on the topic, does the same thing happen with Google App Engine? I'm currently just trying out these app hosting platforms so I don't really have any preference for technologies/languages.

like image 570
Steve Avatar asked Mar 11 '11 20:03

Steve


People also ask

How long does it take for Heroku to wake up?

A free Heroku web dyno will go to sleep if it does not receive any web traffic within a 30 minute period. When a sleeping dyno receives web traffic it will become active again, but there is a short delay as the application needs to be reloaded.

Will Heroku stop being free?

Starting October 26, 2022, we will begin deleting inactive accounts and associated storage for accounts that have been inactive for over a year. Starting November 28, 2022, we plan to stop offering free product plans and plan to start shutting down free dynos and data services.

Do Heroku dynos restart?

Dynos are ephemeral by design. They are cycled (restarted) at least once a day to help maintain the health of your app and overall system, and they permit graceful exit to process remaining requests. For apps running multiple dynos, each will be cycled at different intervals.

How long does Heroku app stay up?

Their free tier is enough to accomplish pretty much any task, but it comes with one giant limitation: your app will go to sleep after an hour of inactivity.


2 Answers

Quickest way to "fix" this problem is to make sure your site is always up. Set up a pingdom account (http://www.pingdom.com/) which will ping your site every few minutes just to keep it alive.

I have a special route myapp.com/keep_alive which does nothing except hit the rails stack without caching.

Hopefully this helps!

like image 130
jonnii Avatar answered Nov 06 '22 09:11

jonnii


Do you happen to be hosting it with the 'free plan', ie. only with 1 dyno?

If so, what you experience might be a Dyno Idling. You can increase the number of the dynos so that your app is 'always-on'

like image 24
ryanprayogo Avatar answered Nov 06 '22 09:11

ryanprayogo