1 == Other Profiling Tools ==
3 There are a lot of great profiling tools out there. Some free, some not so free. This is a sort list detailing some of them.
6 http://www.hpl.hp.com/research/linux/httperf/[http://www.hpl.hp.com/research/linux/httperf/]
8 A necessary tool in your arsenal. Very useful for load testing your website.
10 #TODO write and link to a short article on how to use httperf. Anybody have a good tutorial availble.
13 === Rails Analyzer ===
15 The Rails Analyzer project contains a collection of tools for Rails. It's open source and pretty speedy. It's not being actively worked on but is still contains some very useful tools.
17 * The Production Log Analyzer examines Rails log files and gives back a report. It also includes action_grep which will give you all log results for a particular action.
19 * The Action Profiler similar to Ruby-Prof profiler.
21 * rails_stat which gives a live counter of requests per second of a running Rails app.
23 * The SQL Dependency Grapher allows you to visualize the frequency of table dependencies in a Rails application.
25 Their project homepage can be found at http://rails-analyzer.rubyforge.org/[http://rails-analyzer.rubyforge.org/]
27 The one major caveat is that it needs your log to be in a different format from how rails sets it up specifically SyslogLogger.
30 ==== SyslogLogger ====
32 SyslogLogger is a Logger work-alike that logs via syslog instead of to a file. You can add SyslogLogger to your Rails production environment to aggregate logs between multiple machines.
34 More information can be found out at http://rails-analyzer.rubyforge.org/hacks/classes/SyslogLogger.html[http://rails-analyzer.rubyforge.org/hacks/classes/SyslogLogger.html]
36 If you don't have access to your machines root system or just want something a bit easier to implement there is also a module developed by Geoffrey Grosenbach
38 ==== A Hodel 3000 Compliant Logger for the Rest of Us ====
41 http://topfunky.net/svn/plugins/hodel_3000_compliant_logger/lib/hodel_3000_compliant_logger.rb[link to module file]
43 Just put the module in your lib directory and add this to your environment.rb in it's config portion.
45 ------------------------------------------------------------
46 require 'hodel_3000_compliant_logger'
47 config.logger = Hodel3000CompliantLogger.new(config.log_path)
48 -------------------------------------------------------------
50 It's that simple. Your log output on restart should look like this.
53 ----------------------------------------------------------------------------
54 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
55 Parameters: {"action"=>"shipping", "controller"=>"checkout"}
56 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
57 [4;36;1mBook Columns (0.003155)
\e[0m
\e[0;1mSHOW FIELDS FROM `books`
\e[0m
58 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
59 [4;35;1mBook Load (0.000881)
\e[0m
\e[0mSELECT * FROM `books` WHERE (`books`.`id` = 1 AND (`books`.`sold` = 1))
\e[0m
60 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
61 [4;36;1mShippingAddress Columns (0.002683)
\e[0m
\e[0;1mSHOW FIELDS FROM `shipping_addresses`
\e[0m
62 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
63 [4;35;1mBook Load (0.000362)
\e[0m
\e[0mSELECT ounces FROM `books` WHERE (`books`.`id` = 1)
\e[0m
64 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
65 Rendering template within layouts/application
66 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
67 Rendering checkout/shipping
68 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
69 [4;36;1mBook Load (0.000548)
\e[0m
\e[0;1mSELECT * FROM `books`
70 WHERE (sold = 0) LIMIT 3
\e[0m
71 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
\e
72 [4;35;1mAuthor Columns (0.002571)
\e[0m
\e[0mSHOW FIELDS FROM `authors`
\e[0m
73 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
74 \e[4;36;1mAuthor Load (0.000811)
\e[0m
\e[0;1mSELECT * FROM `authors` WHERE (`authors`.`id` = 1)
\e[0m
75 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
76 Rendered store/_new_books (0.01358)
77 Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]:
78 Completed in 0.37297 (2 reqs/sec) | Rendering: 0.02971 (7%) | DB: 0.01697 (4%) | 200 OK [https://secure.jeffbooks/checkout/shipping]
79 ----------------------------------------------------------------------------
82 An open source mysql query analyzer. Full featured and easy to work with. Also requires Hodel 3000
83 http://www.flyingmachinestudios.com/projects/[http://www.flyingmachinestudios.com/projects/]
86 http://www.newrelic.com/[http://www.newrelic.com/]
88 Pretty nifty performance tools, pricey though. They do have a basic free
89 service both for when in development and when you put your application into production. Very simple installation and signup.
91 #TODO more in-depth without being like an advertisement.
95 Like new relic a production monitoring tool.