Rails 3.2.1 开发模式极其缓慢

发布于 2025-01-04 08:08:33 字数 844 浏览 4 评论 0原文

为什么我的 Rails 开发环境如此缓慢?我在日志中看到一次调用需要 2-3 秒,而控制器操作的实际时间约为 10 秒。大部分时间似乎都花在了资产管道上。

像 Rails-dev-tweaks 这样的 Gem 到目前为止并没有真正的帮助。

  • 我的设置:
  • OS X
  • 通过 rvm
  • Rails 3.2.1
  • 日志输出安装 MySQL
  • 完全更新了 Ruby 1.9.3-p0 通过 homebrew Server POW 或 webrick

Started GET "/" for 127.0.0.1 at 2012-02-10 13:14:34 +0000
Processing by HomeController#index as HTML
  User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  User Load (0.7ms)  SELECT `users`.* FROM `users` 
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 1 LIMIT 1
  Rendered home/index.html.erb within layouts/application (40.2ms)
  Rendered shared/_navigation.html.erb (0.7ms)
Completed 200 OK in 2084ms (Views: 44.6ms | ActiveRecord: 9.6ms)

Why is my Rails development environment so terribly slow? I am seeing 2-3 seconds in the log for a call, the actually time is about 10 seconds for a controller action. A good chunk of time seems to be spent on the asset pipeline.

Gems like rails-dev-tweaks do not really help so far.

  • My Setup:
  • OS X fully updated
  • Ruby 1.9.3-p0 via rvm
  • Rails 3.2.1
  • MySQL installed via homebrew
  • Server POW or webrick

log output:

Started GET "/" for 127.0.0.1 at 2012-02-10 13:14:34 +0000
Processing by HomeController#index as HTML
  User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  User Load (0.7ms)  SELECT `users`.* FROM `users` 
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 1 LIMIT 1
  Rendered home/index.html.erb within layouts/application (40.2ms)
  Rendered shared/_navigation.html.erb (0.7ms)
Completed 200 OK in 2084ms (Views: 44.6ms | ActiveRecord: 9.6ms)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在夏天 2025-01-11 08:08:33

好吧,我知道是什么让它变慢了。这是来自应用程序模板的 Rails Footnotes gem: http://github.com /RailsApps/rails3-devise-rspec-cucumber

我还在 github 上创建了一个问题:
https://github.com/RailsApps/rails3-devise-rspec-cucumber /问题/22

OK, I figured out what made it slow. It was the Rails Footnotes gem that came with the app template from: http://github.com/RailsApps/rails3-devise-rspec-cucumber

I have also created an issue on github:
https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/22

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文