首页 文章

Rails Bundler.require花了太长时间 . 结果Phusion Passenger在启动时抛出错误

提问于
浏览
0

我正在尝试启动我的phusion乘客服务器 . 而我得到的错误是

An error occurred while starting up the preloader: it did not write a startup response in time.

我跟随这个wiki来自phusion passenger https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems

我发现我的rails应用程序卡在Bundler.require行的config / application.rb中 . 看起来我有很多宝石而且Bundler.require需要花费很多时间,然后phusion乘客服务器退出 .

我怎样才能克服这个问题 .

这是服务器链接http://zenkars.com/

1 回答

  • 0

    一种选择可能是在实际需要之前推迟需要宝石 . 您可以在 application.rb 文件中使用 Bundler.setup 而不是 Bundler.require 来执行此操作 . 有关详细信息,请参阅Pan Thomakos的Myron Marston的文章5 Reasons to Avoid Bundler.requireA Simple Rails Boot Time Improvement .

    然而,这可能只会延迟问题,导致请求缓慢而不是慢启动 . 追踪哪些宝石最慢需要并查看是否有更新的版本或其他替代方案来加速它们将是一个好主意 .

    您也可以尝试更新版本的Ruby,因为一些旧版本已知存在许多需求的性能问题 . 有关详细信息,请参阅Greg Price的Profiling Ruby, or, How I Made Rails Start Up Faster .

相关问题