You can use profiling to determine where the performance bottlenecks are in specific Rails actions. Watch this episode for details.
# config/environments/staging.rb
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
config.log_level = :debug
# lib/products_index_profiler.rb
get '/products'
say "GET #{path}"
$ script/server -e staging
$ sudo gem install ruby-prof
$ RAILS_ENV=staging script/performance/request lib/products_index_profiler.rb
通过使用剖析工具定位Rails应用程序中特定操作的性能瓶颈。本篇详细介绍了如何配置Rails环境以启用缓存,并利用ruby-prof gem进行性能剖析。
107

被折叠的 条评论
为什么被折叠?



