使用active_admin后,webrick变得非常慢

时间:2011-10-19 12:58:08

标签: ruby-on-rails-3 ruby-on-rails-3.1 activeadmin

注意完成请求是多么耗时

Started GET "/" for 127.0.0.1 at 2011-10-19 20:45:38 +0800
Processing by MainController#index as HTML
Book Load (0.9ms)  SELECT "books".* FROM "books" 
Rendered application/_product.html.erb (66.8ms)
Rendered main/index.html.erb within layouts/application (158.7ms)
Rendered application/_header.html.erb (45.6ms)
Rendered application/_search_cart.html.erb (1.6ms)
Completed 200 OK in 350ms (Views: 347.9ms | ActiveRecord: 0.9ms)

有什么想法吗?

我还有什么选择将webrick替换为默认服务器!

1 个答案:

答案 0 :(得分:0)

您可以尝试使用rails-dev-boost gem(https://github.com/thedarkone/rails-dev-boost),将以下内容添加到您的gemfile并进行捆绑安装

gem 'rails-dev-boost', :git => 'https://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'

但要注意,在更改lib /文件夹,初始化程序等中的代码时,仍需要重新启动服务器。

你也可以尝试让mongrel作为开发服务器工作。根据您的红宝石/铁轨组合,以下内容会发生变化。关于http://jan.varwig.org/archive/rails-3-and-mongrel的更多线索和信息,这应该适用于rails 3.1和ruby 1.9.2 combo

group :development, :test do
  # ...
  # http://jan.varwig.org/archive/rails-3-and-mongrel
  gem 'mongrel', '>= 1.2.0.pre2'
end