Heroku App Boot Timeout

前端 未结 3 690
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 03:51

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 crash

相关标签:
3条回答
  • 2021-01-03 04:17

    The heroku-forward gem will help you beat the 60s Heroku timeout.

    0 讨论(0)
  • 2021-01-03 04:26

    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).

    0 讨论(0)
  • 2021-01-03 04:30

    Heroku's boot timeout bit me too. I read several blog posts about how to get around it and ended up automating some of the solutions into a gem.

    To reduce the startup time on deploy, you can trim the gems loaded at boot time (this doesn't mean you have to trim them from the app, just boot time).

    gem_bench evaluates which gems are likely to not be needed at boot time.

    I have an app with about 250 gems and was able to add :require => false to about 60 of them, with dramatic effects.

    https://github.com/acquaintable/gem_bench

    Disclaimer: I am the author of this open source ruby gem. I wrote the gem to aid myself in solving this exact problem: the 60 second timeout on Heroku.

    0 讨论(0)
提交回复
热议问题