Heroku - Spin Up
Asked Answered
P

5

15

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.

Pons answered 11/3, 2011 at 20:52 Comment(2)
App Engine has similar issues. They're somewhat mitigated by the new-ish (1.4.0) "warm up request" feature, and "always on" instances.Shanley
This is really two questions.Enamelware
F
11

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!

Flocculus answered 11/3, 2011 at 21:9 Comment(2)
how do you 'hit the rails stack without caching' ?Interlocutrix
caching on heroku uses varnish, so just make sure you don't set any caching related headers. if it's a simple method that just renders a view you'll be ok.Flocculus
I
4

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'

Interlocutrix answered 11/3, 2011 at 21:1 Comment(0)
C
2

From what I understand Heroku makes public this behaviour.

For free site hosting, one heroku 'Dyno' is dedictaed to your site, if the dyno is inactive for a period of time then the resource will be redirected elsewhere, when you try access the site after this time the system has to go request a Dyno back.

You can prevent this by paying for extra dyno's which will stick with your site or you can visit the site on a regular basis yourself with a automated script.

Coe answered 11/3, 2011 at 21:6 Comment(0)
A
0

The best thing you can do to decrease this time is to minimize the size of your slug. This includes steps like deleting any PSD or AI image assets, removing PDFs, and minimizing your gem set. For more information see: http://devcenter.heroku.com/articles/slug-size. As a reference, my applications can usually spin up in under around one second.

Anguilliform answered 11/3, 2011 at 20:57 Comment(0)
S
0

If you don't want to pay for Pingdom, you can try the open source alternative: Pinger

https://github.com/austinthecoder/pinger

Sleepyhead answered 9/11, 2011 at 3:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.