Heroku 应用程序启动超时 [英] Heroku App Boot Timeout

查看:49
本文介绍了Heroku 应用程序启动超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当大的 2.3 升级到 Rails 3 应用程序,它足够胖,无法通过 Heroku 的 60 秒启动门,因此它崩溃了.我已经做了很多工作来最小化 Gems 和初始化程序中的加载时间,但是有一些随机过程正在消耗时间,我不确定它是什么.我可以用另一组眼睛.

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.

这是一个包含 config.ru、application.rb 和 environment.rb 以及 Gemfile 的 GIST.

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

https://gist.github.com/2026140

任何想法将不胜感激.

推荐答案

至少在我的情况下,这是由于两件事:1) 很多 gem,以及 2) Mongo 需要很长时间来初始化(大负担过重的数据库).

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

为了修复 gems,在我的本地开发人员上,我修补了 bundler Kernel#require 语句,以便我可以看到哪些加载时间最长.然后,我试图删除它们.除此之外,我将它们设置为 :require => false 并在需要的地方手动要求它们.

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.

其次,我对 Mongoid 进行了猴子修补,以便在应用程序启动时它不会尝试连接到数据库.这对缓慢的启动时间(删除超过 10 秒)有很大帮助.

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

这篇关于Heroku 应用程序启动超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆