What tools do you recommend profiling Rails applications?

I have been looking for tools for profiling Rails for a while. I am currently playing and testing ruby-prof and railsbench, but I am a bit disappointed to need to be set up and configured in order to work later.

Although I am not opposed to the (subtlety) customization, I would like to know if there are other, simpler and easier to use tools for profiling a Rails application? What tools do you recommend?

+45
profiling ruby ruby-on-rails
Dec 08 '08 at 18:56
source share
7 answers

The new relic offers Rails profiling, including the free 'Lite' .

+20
08 Dec '08 at 20:39
source share

You can also use the built-in profiler :

$ ruby script/performance/profiler 'User.new' 5 % cumulative self self total time seconds seconds calls ms/call ms/call name 189.25 1.76 1.76 1 1760.00 1760.00 Profiler__.start_profile 43.01 2.16 0.40 115 3.48 3.91 ActiveRecord::ConnectionAdapters::Column#simplified_type 8.60 2.24 0.08 15 5.33 8.67 Array#each 7.53 2.31 0.07 115 0.61 5.39 ActiveRecord::ConnectionAdapters::Column#initialize 6.45 2.37 0.06 115 0.52 0.52 ActiveRecord::ConnectionAdapters::Column#type_cast 5.38 2.42 0.05 690 0.07 0.07 Regexp#=== 0.00 2.69 0.00 10 0.00 0.00 Process.times 0.00 2.69 0.00 10 0.00 0.00 Benchmark.times 

Note that for Rails 3 you can use rails profiler .

+44
Dec 10 '08 at 13:50
source share

Rack error is pretty cool http://github.com/brynary/rack-bug

+5
Dec 23 '09 at 13:08
source share

http://rails-analyzer.rubyforge.org/ may be what you are looking for.

I highly recommend the production log analyzer for a clear list of the most time-consuming activities, as well as the action profiler.

added: for the production log analyzer you do not need any configuration, it just analyzes the production log and gives you a list of the most labor-intensive actions, including min / max / median time. It is very nice to see where you should profile / optimize more.

+4
Dec 08 '08 at 19:19
source share

Another worth checking out is the Mini Profiler: https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby

It is used in StackExchange (although this version is ported to Ruby).

Here is the Railscast: http://railscasts.com/episodes/368-miniprofiler?view=asciicast

+3
Nov 04
source share

If you are under OSX Leopard, you can try DTrace.

+2
Dec 09 '08 at 5:05
source share

You should also take a look at FiveRuns TuneUp . It is completely free, installs as a plugin in your Rails application. Keep in mind that it sends the data back to its server (mostly very harmless information), but this may bother some people (namely, government agencies will be very unhappy with this). I think you will be surprised at how well the tool treats this for free.

Another nice feature is that you can post your launch data so that others can comment and help you diagnose your long requests or bad code.

0
Dec 09 '08 at 5:00
source share



All Articles