Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku App Boot Timeout

I've got a rather large, 2.3 upgraded to Rails 3 application, that's fat enough it's not making it through the 60 second startup door at Heroku, and therefore it's crashing. I've done a bunch of work to minimize load times within Gems and initializers, but there's some random process that's burning time and I'm not exactly sure what it is. I could use another set of eyes.

Here's a GIST with the config.ru, application.rb, and environment.rb and the Gemfile.

https://gist.github.com/2026140

Any thoughts would be greatly appreciated.

like image 650
Williamf Avatar asked Mar 13 '12 02:03

Williamf


People also ask

What is heroku boot time?

The default boot timeout is 60 seconds. An exception is for apps using the Java buildpack, Gradle buildpack, heroku-deploy toolbelt plugin, or Heroku Maven plugin, which will be allowed 90 seconds to bind to their assigned port.

Why does heroku app crash?

If your Procfile is pointing to the wrong server file. e.g If your server is in server. js and your Procfile points to app. js this would definitely crash your app and Heroku would greet you with the H10-App crashed error code message.


1 Answers

This was due, at least in my case, to two things: 1) a lot of gems, and 2) Mongo taking a long time to initialize (big burdened database).

To fix the gems, on my local dev, I patched bundler Kernel#require statement so I could see which were taking the longest to load. Then, I tried to remove them. Barring that, I set them to :require => false and manually required them where they were needed.

Secondly, I monkey patched Mongoid so that it doesn't try to connect to the database when the app is starting. This helped dramatically with the slow boot time (removed over 10 seconds).

like image 190
Williamf Avatar answered Oct 12 '22 10:10

Williamf