Rails 4 memory profiling

拜拜、爱过 提交于 2019-12-21 06:00:32

问题


I need to profile the memory usage of a rails 4 application (using ruby MRI). A little bit of googling made me step into http://guides.rubyonrails.org/v3.2.13/performance_testing.html

I have two questions :

  • Is it compatible with rails 4
  • I am using rspec. It seems that my rake test tasts are not available (neither rails generator performance_test). When I type rake test:profile for instance, I receive Don't know how to build task 'test:profile'. Does anybody know how to fix this ?

Thanks in advance for your help.


回答1:


Oink is something I use with Rails 4.

Oink adds memory and active record instantiation information to rails log during runtime and provides an executable to help digest the enhanced logs.

Given a minimum threshold and a metric (memory or active record instantiation), the oink executable reports:

The top ten single requests which exceeded the threshold for the metric, ordered by the request which exceeded the threshold the most

The number of times each action exceeded the threshold for the metric, ordered by the action which exceeded the threshold the most

(in verbose mode) The log lines produced by requests which exceeded the threshold




回答2:


I am not sure if it will work with MRI 2.1.0 but when I worked at Engine Yard will always recommended this tool:

Binary Logic's Memory Logic

One big warning about it though. It logs performance so you only want to do this in development or on a test server. Do not put it in to production or your application will grind to a halt. Hope this helps.

Mike Riley



来源:https://stackoverflow.com/questions/22101737/rails-4-memory-profiling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!