aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/bechmarking_and_profiling/appendix.txt
blob: ce618603d42010f902de837012e2e8f1b85221e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
== Other Profiling Tools ==

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. 

=== httperf ===
http://www.hpl.hp.com/research/linux/httperf/[http://www.hpl.hp.com/research/linux/httperf/]

A necessary tool in your arsenal. Very useful for load testing your website.

#TODO write and link to a short article on how to use httperf. Anybody have a good tutorial availble. 


=== Rails Analyzer ===

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. 

* 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.

* The Action Profiler similar to Ruby-Prof profiler.

* rails_stat which gives a live counter of requests per second of a running Rails app.

* The SQL Dependency Grapher allows you to visualize the frequency of table dependencies in a Rails application.

Their project homepage can be found at http://rails-analyzer.rubyforge.org/[http://rails-analyzer.rubyforge.org/]

The one major caveat is that it needs your log to be in a different format from how rails sets it up specifically SyslogLogger. 


==== SyslogLogger ====

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.

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]

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

==== A Hodel 3000 Compliant Logger for the Rest of Us ====

Directions taken from 
http://topfunky.net/svn/plugins/hodel_3000_compliant_logger/lib/hodel_3000_compliant_logger.rb[link to module file]

Just put the module in your lib directory and  add this to your environment.rb in it's config portion. 

------------------------------------------------------------
require 'hodel_3000_compliant_logger'
config.logger = Hodel3000CompliantLogger.new(config.log_path)
-------------------------------------------------------------

It's that simple. Your log output on restart should look like this. 

.Hodel 3000 Example
----------------------------------------------------------------------------
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Parameters: {"action"=>"shipping", "controller"=>"checkout"}
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;36;1mBook Columns (0.003155)   SHOW FIELDS FROM `books`
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;35;1mBook Load (0.000881)   SELECT * FROM `books` WHERE (`books`.`id` = 1 AND (`books`.`sold` = 1)) 
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;36;1mShippingAddress Columns (0.002683)   SHOW FIELDS FROM `shipping_addresses`
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;35;1mBook Load (0.000362)   SELECT ounces FROM `books` WHERE (`books`.`id` = 1) 
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Rendering template within layouts/application
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Rendering checkout/shipping
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;36;1mBook Load (0.000548)   SELECT * FROM `books` 
WHERE (sold = 0) LIMIT 3
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
[4;35;1mAuthor Columns (0.002571)   SHOW FIELDS FROM `authors`
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Author Load (0.000811)   SELECT * FROM `authors` WHERE (`authors`.`id` = 1) 
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Rendered store/_new_books (0.01358)
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: 
Completed in 0.37297 (2 reqs/sec) | Rendering: 0.02971 (7%) | DB: 0.01697 (4%) | 200 OK [https://secure.jeffbooks/checkout/shipping]
----------------------------------------------------------------------------

=== Palmist === 
An open source mysql query analyzer. Full featured and easy to work with. Also requires Hodel 3000 
http://www.flyingmachinestudios.com/projects/[http://www.flyingmachinestudios.com/projects/]

=== New Relic === 
http://www.newrelic.com/[http://www.newrelic.com/]

Pretty nifty performance tools, pricey though. They do have a basic free
service both for when in development and when you put your application into production. Very simple installation and signup.

#TODO more in-depth without being like an advertisement. 

=== FiveRuns ===
http://www.fiveruns.com/[http://www.fiveruns.com/]

#TODO give a bit more detail

==== TuneUp ====

In their words "a new socially networked application profiling tool for Ruby on Rails developers. Designed for rapid application performance analysis in development, both privately or collaboratively with input from the community, FiveRuns TuneUp gives developers visibility into performance trouble spots and bottlenecks before they reach production."

==== Manage ====

Like new relic a production monitoring tool.