美洲狮:更快的服务器重新加载?

时间:2014-05-14 00:23:19

标签: ruby-on-rails ruby ruby-on-rails-3 puma

我使用Puma作为Rails应用程序,我需要加快迭代循环,使文件更改并让Web服务器能够重新加载页面。现在它需要至少30秒,这太慢了。理想情况下,它只需几秒钟。

这是启动服务器的输出,如果有帮助:

[26861] Puma starting in cluster mode...
[26861] * Version 2.8.2 (ruby 2.0.0-p451)
[26861] * Min threads: 4, max threads: 8
[26861] * Environment: development
[26861] * Process workers: 1
[26861] * Preloading application
[SKYLIGHT] [0.3.12] Running Skylight in development mode. No data will be reported until you deploy your app.
Deprecated, please require 'sidekiq/pro/web' now at /usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.18/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
[26861] * Listening on tcp://0.0.0.0:4000
[26861] Use Ctrl-C to stop
[26939] + Gemfile in context: ~/project/Gemfile
2014-05-14T00:18:16Z 26939 TID-owgxfytuc INFO: Sidekiq Pro client with redis options {:url=>"redis://localhost:6001”, :driver=>:hiredis}
[26861] - Worker 0 (pid: 26939) booted, phase: 0

1 个答案:

答案 0 :(得分:4)

您应该能够在rails应用程序中进行更改,而无需在开发模式下重新启动服务器(这是我假设您所在的)。有一些例外情况,例如初始化程序和迁移需要完全重新启动,但大多数时候您应该能够逃脱而不重新启动服务器。

然而,还有应用程序预加载器,通过观察文件更改和加载服务器来加快服务器启动时间。

从rails 4.1开始,这已经通过弹簧https://github.com/rails/spring滚动到框架中,弹簧https://github.com/burke/zeus向上支撑了导轨3.2。

我使用的另一个预加载器是Zeus,效果很好{{3}}

那不是预先装载机的详尽清单,只是我实际使用的那些

希望有所帮助