了解Ruby on Rails渲染时间 [英] Understanding Ruby on Rails render times
问题描述
我正在对应用程序进行优化",并且试图了解rails(版本2.2.2)在渲染结束时提供的输出.
这是旧"方式:
Rendered user/_old_log (25.7ms)
Completed in 466ms (View: 195, DB: 8) | 200 OK
新"方式:
Rendered user/_new_log (48.6ms)
Completed in 337ms (View: 192, DB: 33) | 200 OK
这些查询完全相同,不同之处在于旧方法是分析日志文件,而新方法是查询数据库日志表.
页面的实际速度不是问题(用户理解这是一个缓慢的请求)...但是我希望页面尽可能快地做出响应,即使它是一个慢"的页面. /p>
所以,我的问题是,数字代表/意味着什么?换句话说,哪种方法是更快的方法,为什么?
此:
Rendered user/_old_log (25.7ms)
是渲染 just _old_log
部分模板的时间,它来自 ActionView :: LogSubscriber
此:
Completed 200 OK in 466ms
是否返回了http状态以及整个请求的总时间.它来自 ActionController :: LogSubscriber .
还要注意最后的括号:
(Views: 124.6ms | ActiveRecord: 10.8ms)
分别是呈现整个视图(部分和所有内容)和所有数据库请求的总时间,它们来自
Here is the "old" way: And the "new" way: These queries were exactly the same, the difference is the old way is parsing log files while the new way is querying the database log table. The actual speed of the page is not the issue (the user understands that this is a slow request) ... but I would like the page to respond as quickly as possible even though it is a "slow" page. So, my question is, what do the numbers represent/mean? In other words, which way was the faster method and why? This: is the time to render just the This: Is the http status returned, as well as the total time for the entire request. It comes from ActionController::LogSubscriber. Also, note those parenthetical items at the end: Those are the total times for rendering the entire view (partials & everything) and all database requests, respectively, and come from ActionController::LogSubscriber as well. 这篇关于了解Ruby on Rails渲染时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!Rendered user/_old_log (25.7ms)
Completed in 466ms (View: 195, DB: 8) | 200 OK
Rendered user/_new_log (48.6ms)
Completed in 337ms (View: 192, DB: 33) | 200 OK
Rendered user/_old_log (25.7ms)
_old_log
partial template, and comes from an ActiveSupport::Notification getting processed by ActionView::LogSubscriberCompleted 200 OK in 466ms
(Views: 124.6ms | ActiveRecord: 10.8ms)