在 652 毫秒内完成 200 次 OK(查看次数:50.9 毫秒 | ActiveRecord:18.3 毫秒) [英] Completed 200 OK in 652ms (Views: 50.9ms | ActiveRecord: 18.3ms)
问题描述
我正在尝试理解 rails 日志中的这一行
I'm trying to understand this line in the rails log
如果我的视图只需要 50.9 毫秒,为什么需要 652 毫秒?
If my views only took 50.9ms why is it taking 652ms?
谢谢
推荐答案
如果您在开发环境中运行您的应用程序,它必须在每次请求时重新加载大量应用程序文件.这就是我对为什么要花这么长时间的猜测.
If you're running your application in the development environment it has to reload a lot of your application's files on every request. That would be my guess as to why it's taking so long.
您可以尝试进入 environments/development.rb
并设置 config.cache_classes = true
以查看这对渲染时间有何影响,但请记住将此更改回 config.cache_classes = false
并在完成后重新启动服务器.
You could try going into environments/development.rb
and setting config.cache_classes = true
to see what kind of effect this has on your render times, but remember to change this back to config.cache_classes = false
and restart your server once you're done.
这篇关于在 652 毫秒内完成 200 次 OK(查看次数:50.9 毫秒 | ActiveRecord:18.3 毫秒)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!