我正在尝试启动我的phusion乘客服务器。而我得到的错误是
An error occurred while starting up the preloader: it did not write a startup response in time.
我从phusion乘客那里听了这个维基 https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems
我发现我的rails应用程序卡在Bundler.require行的config / application.rb中。看起来我有很多宝石而且Bundler.require需要花费很多时间,而且当时的phusion乘客服务器会退出。
我如何克服这个问题。
这是服务器链接http://zenkars.com/
答案 0 :(得分:0)
一种选择可能是在实际需要之前推迟要求你的宝石。您可以在Bundler.setup
文件中使用Bundler.require
代替application.rb
来执行此操作。有关详细信息,请参阅Myron Marston撰写的文章5 Reasons to Avoid Bundler.require和A Simple Rails Boot Time Improvement作者:Pan Phomakos。
然而,这可能会延迟问题,导致请求缓慢而不是缓慢启动。最好跟踪哪些宝石最慢需要,看看是否有更新版本或其他替代方案来加速它们。
您也可以尝试更新版本的Ruby,因为一些旧版本已知存在许多需求的性能问题。有关详细信息,请参阅Greg Price的Profiling Ruby, or, How I Made Rails Start Up Faster。