railsbench 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/BUGS +3 -0
- data/CHANGELOG +0 -0
- data/INSTALL +55 -0
- data/LICENSE +222 -0
- data/Manifest.txt +38 -0
- data/README +254 -0
- data/Rakefile +51 -0
- data/bin/railsbench +50 -0
- data/config/benchmarking.rb +8 -0
- data/config/benchmarks.rb +20 -0
- data/config/benchmarks.yml +49 -0
- data/install.rb +60 -0
- data/lib/benchmark.rb +576 -0
- data/lib/railsbench/gc_info.rb +123 -0
- data/lib/railsbench/perf_info.rb +145 -0
- data/lib/railsbench/perf_utils.rb +65 -0
- data/lib/railsbench/railsbenchmark.rb +397 -0
- data/lib/railsbench/version.rb +9 -0
- data/lib/railsbench/write_headers_only.rb +15 -0
- data/ruby184gc.patch +516 -0
- data/ruby185gc.patch +535 -0
- data/script/perf_bench +76 -0
- data/script/perf_comp +155 -0
- data/script/perf_comp_gc +109 -0
- data/script/perf_diff +48 -0
- data/script/perf_diff_gc +89 -0
- data/script/perf_html +82 -0
- data/script/perf_loop +38 -0
- data/script/perf_plot +94 -0
- data/script/perf_plot_gc +111 -0
- data/script/perf_prof +51 -0
- data/script/perf_run +34 -0
- data/script/perf_run_gc +46 -0
- data/script/perf_tex +62 -0
- data/script/perf_times +70 -0
- data/script/perf_times_gc +86 -0
- data/script/run_urls +46 -0
- data/setup.rb +1585 -0
- data/test/railsbench_test.rb +11 -0
- metadata +91 -0
data/BUGS
ADDED
data/CHANGELOG
ADDED
File without changes
|
data/INSTALL
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
============
|
2
|
+
INSTALLATION
|
3
|
+
============
|
4
|
+
|
5
|
+
STEP 1: installing railsbench and PATH modifcation
|
6
|
+
|
7
|
+
If you obtained and installed railsbench as a gem, a script called
|
8
|
+
railsbench is available in you Ruby bin directory. railsbench is a
|
9
|
+
simple driver for the railsbench scripts, which are located in the gem
|
10
|
+
installation directory. Example:
|
11
|
+
|
12
|
+
railsbench perf_run 100 -bm=all
|
13
|
+
|
14
|
+
Alternatively, add the railsbench script directory to your search
|
15
|
+
path. The exact place can be found running
|
16
|
+
|
17
|
+
railsbench base
|
18
|
+
|
19
|
+
which prints the script directory path. After that change, individual
|
20
|
+
commands can be run directly:
|
21
|
+
|
22
|
+
railsbench perf_run 100 -bm=all
|
23
|
+
|
24
|
+
The environment variable RAILS_ROOT must be set and point to your apps
|
25
|
+
base directory, in order for railsbench to work properly.
|
26
|
+
|
27
|
+
If you obtained railsbench as a svn checkout, add the railsbench
|
28
|
+
script directory to your search path.
|
29
|
+
|
30
|
+
|
31
|
+
STEP 2: prepare your application for benchmarking
|
32
|
+
|
33
|
+
Manual installation:
|
34
|
+
|
35
|
+
Copy benchmarks.rb and benchmarks.yml into $RAILS_ROOT/config and
|
36
|
+
edit them to suit your needs. The provided default benchmark.yml
|
37
|
+
will run the root URL of your app.
|
38
|
+
|
39
|
+
Copy benchmarking.rb to $RAILS_ROOT/config/environments and add a
|
40
|
+
corresponding section to database.yml.
|
41
|
+
|
42
|
+
Automatic installation:
|
43
|
+
|
44
|
+
Run railsbench install. This will perform all of the above steps and
|
45
|
+
create a section in database.yml pointing to your development
|
46
|
+
database. In case you are worrying about possible results, you can
|
47
|
+
call railsbench install --dry-run first.
|
48
|
+
|
49
|
+
|
50
|
+
STEP 3: optional (but highly recommended)
|
51
|
+
|
52
|
+
Patch the ruby garbage collector using rubygc18{45}.patch, depending
|
53
|
+
on your ruby version. Recompile ruby and copy the ruby binary and
|
54
|
+
shared libs to where it was previously installed. See GCPATCH for
|
55
|
+
details on how to influence the patched ruby gc.
|
data/LICENSE
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
3
|
+
|
4
|
+
0. This License applies to any program or other work which contains
|
5
|
+
a notice placed by the copyright holder saying it may be distributed
|
6
|
+
under the terms of this General Public License. The "Program", below,
|
7
|
+
refers to any such program or work, and a "work based on the Program"
|
8
|
+
means either the Program or any derivative work under copyright law:
|
9
|
+
that is to say, a work containing the Program or a portion of it,
|
10
|
+
either verbatim or with modifications and/or translated into another
|
11
|
+
language. (Hereinafter, translation is included without limitation in
|
12
|
+
the term "modification".) Each licensee is addressed as "you".
|
13
|
+
|
14
|
+
Activities other than copying, distribution and modification are not
|
15
|
+
covered by this License; they are outside its scope. The act of
|
16
|
+
running the Program is not restricted, and the output from the Program
|
17
|
+
is covered only if its contents constitute a work based on the
|
18
|
+
Program (independent of having been made by running the Program).
|
19
|
+
Whether that is true depends on what the Program does.
|
20
|
+
|
21
|
+
1. You may copy and distribute verbatim copies of the Program's
|
22
|
+
source code as you receive it, in any medium, provided that you
|
23
|
+
conspicuously and appropriately publish on each copy an appropriate
|
24
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
25
|
+
notices that refer to this License and to the absence of any warranty;
|
26
|
+
and give any other recipients of the Program a copy of this License
|
27
|
+
along with the Program.
|
28
|
+
|
29
|
+
You may charge a fee for the physical act of transferring a copy, and
|
30
|
+
you may at your option offer warranty protection in exchange for a fee.
|
31
|
+
|
32
|
+
2. You may modify your copy or copies of the Program or any portion
|
33
|
+
of it, thus forming a work based on the Program, and copy and
|
34
|
+
distribute such modifications or work under the terms of Section 1
|
35
|
+
above, provided that you also meet all of these conditions:
|
36
|
+
|
37
|
+
a) You must cause the modified files to carry prominent notices
|
38
|
+
stating that you changed the files and the date of any change.
|
39
|
+
|
40
|
+
b) You must cause any work that you distribute or publish, that in
|
41
|
+
whole or in part contains or is derived from the Program or any
|
42
|
+
part thereof, to be licensed as a whole at no charge to all third
|
43
|
+
parties under the terms of this License.
|
44
|
+
|
45
|
+
c) If the modified program normally reads commands interactively
|
46
|
+
when run, you must cause it, when started running for such
|
47
|
+
interactive use in the most ordinary way, to print or display an
|
48
|
+
announcement including an appropriate copyright notice and a
|
49
|
+
notice that there is no warranty (or else, saying that you provide
|
50
|
+
a warranty) and that users may redistribute the program under
|
51
|
+
these conditions, and telling the user how to view a copy of this
|
52
|
+
License. (Exception: if the Program itself is interactive but
|
53
|
+
does not normally print such an announcement, your work based on
|
54
|
+
the Program is not required to print an announcement.)
|
55
|
+
|
56
|
+
These requirements apply to the modified work as a whole. If
|
57
|
+
identifiable sections of that work are not derived from the Program,
|
58
|
+
and can be reasonably considered independent and separate works in
|
59
|
+
themselves, then this License, and its terms, do not apply to those
|
60
|
+
sections when you distribute them as separate works. But when you
|
61
|
+
distribute the same sections as part of a whole which is a work based
|
62
|
+
on the Program, the distribution of the whole must be on the terms of
|
63
|
+
this License, whose permissions for other licensees extend to the
|
64
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
65
|
+
|
66
|
+
Thus, it is not the intent of this section to claim rights or contest
|
67
|
+
your rights to work written entirely by you; rather, the intent is to
|
68
|
+
exercise the right to control the distribution of derivative or
|
69
|
+
collective works based on the Program.
|
70
|
+
|
71
|
+
In addition, mere aggregation of another work not based on the Program
|
72
|
+
with the Program (or with a work based on the Program) on a volume of
|
73
|
+
a storage or distribution medium does not bring the other work under
|
74
|
+
the scope of this License.
|
75
|
+
|
76
|
+
3. You may copy and distribute the Program (or a work based on it,
|
77
|
+
under Section 2) in object code or executable form under the terms of
|
78
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
79
|
+
|
80
|
+
a) Accompany it with the complete corresponding machine-readable
|
81
|
+
source code, which must be distributed under the terms of Sections
|
82
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
83
|
+
|
84
|
+
b) Accompany it with a written offer, valid for at least three
|
85
|
+
years, to give any third party, for a charge no more than your
|
86
|
+
cost of physically performing source distribution, a complete
|
87
|
+
machine-readable copy of the corresponding source code, to be
|
88
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
89
|
+
customarily used for software interchange; or,
|
90
|
+
|
91
|
+
c) Accompany it with the information you received as to the offer
|
92
|
+
to distribute corresponding source code. (This alternative is
|
93
|
+
allowed only for noncommercial distribution and only if you
|
94
|
+
received the program in object code or executable form with such
|
95
|
+
an offer, in accord with Subsection b above.)
|
96
|
+
|
97
|
+
The source code for a work means the preferred form of the work for
|
98
|
+
making modifications to it. For an executable work, complete source
|
99
|
+
code means all the source code for all modules it contains, plus any
|
100
|
+
associated interface definition files, plus the scripts used to
|
101
|
+
control compilation and installation of the executable. However, as a
|
102
|
+
special exception, the source code distributed need not include
|
103
|
+
anything that is normally distributed (in either source or binary
|
104
|
+
form) with the major components (compiler, kernel, and so on) of the
|
105
|
+
operating system on which the executable runs, unless that component
|
106
|
+
itself accompanies the executable.
|
107
|
+
|
108
|
+
If distribution of executable or object code is made by offering
|
109
|
+
access to copy from a designated place, then offering equivalent
|
110
|
+
access to copy the source code from the same place counts as
|
111
|
+
distribution of the source code, even though third parties are not
|
112
|
+
compelled to copy the source along with the object code.
|
113
|
+
|
114
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
115
|
+
except as expressly provided under this License. Any attempt
|
116
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
117
|
+
void, and will automatically terminate your rights under this License.
|
118
|
+
However, parties who have received copies, or rights, from you under
|
119
|
+
this License will not have their licenses terminated so long as such
|
120
|
+
parties remain in full compliance.
|
121
|
+
|
122
|
+
5. You are not required to accept this License, since you have not
|
123
|
+
signed it. However, nothing else grants you permission to modify or
|
124
|
+
distribute the Program or its derivative works. These actions are
|
125
|
+
prohibited by law if you do not accept this License. Therefore, by
|
126
|
+
modifying or distributing the Program (or any work based on the
|
127
|
+
Program), you indicate your acceptance of this License to do so, and
|
128
|
+
all its terms and conditions for copying, distributing or modifying
|
129
|
+
the Program or works based on it.
|
130
|
+
|
131
|
+
6. Each time you redistribute the Program (or any work based on the
|
132
|
+
Program), the recipient automatically receives a license from the
|
133
|
+
original licensor to copy, distribute or modify the Program subject to
|
134
|
+
these terms and conditions. You may not impose any further
|
135
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
136
|
+
You are not responsible for enforcing compliance by third parties to
|
137
|
+
this License.
|
138
|
+
|
139
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
140
|
+
infringement or for any other reason (not limited to patent issues),
|
141
|
+
conditions are imposed on you (whether by court order, agreement or
|
142
|
+
otherwise) that contradict the conditions of this License, they do not
|
143
|
+
excuse you from the conditions of this License. If you cannot
|
144
|
+
distribute so as to satisfy simultaneously your obligations under this
|
145
|
+
License and any other pertinent obligations, then as a consequence you
|
146
|
+
may not distribute the Program at all. For example, if a patent
|
147
|
+
license would not permit royalty-free redistribution of the Program by
|
148
|
+
all those who receive copies directly or indirectly through you, then
|
149
|
+
the only way you could satisfy both it and this License would be to
|
150
|
+
refrain entirely from distribution of the Program.
|
151
|
+
|
152
|
+
If any portion of this section is held invalid or unenforceable under
|
153
|
+
any particular circumstance, the balance of the section is intended to
|
154
|
+
apply and the section as a whole is intended to apply in other
|
155
|
+
circumstances.
|
156
|
+
|
157
|
+
It is not the purpose of this section to induce you to infringe any
|
158
|
+
patents or other property right claims or to contest validity of any
|
159
|
+
such claims; this section has the sole purpose of protecting the
|
160
|
+
integrity of the free software distribution system, which is
|
161
|
+
implemented by public license practices. Many people have made
|
162
|
+
generous contributions to the wide range of software distributed
|
163
|
+
through that system in reliance on consistent application of that
|
164
|
+
system; it is up to the author/donor to decide if he or she is willing
|
165
|
+
to distribute software through any other system and a licensee cannot
|
166
|
+
impose that choice.
|
167
|
+
|
168
|
+
This section is intended to make thoroughly clear what is believed to
|
169
|
+
be a consequence of the rest of this License.
|
170
|
+
|
171
|
+
8. If the distribution and/or use of the Program is restricted in
|
172
|
+
certain countries either by patents or by copyrighted interfaces, the
|
173
|
+
original copyright holder who places the Program under this License
|
174
|
+
may add an explicit geographical distribution limitation excluding
|
175
|
+
those countries, so that distribution is permitted only in or among
|
176
|
+
countries not thus excluded. In such case, this License incorporates
|
177
|
+
the limitation as if written in the body of this License.
|
178
|
+
|
179
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
180
|
+
of the General Public License from time to time. Such new versions will
|
181
|
+
be similar in spirit to the present version, but may differ in detail to
|
182
|
+
address new problems or concerns.
|
183
|
+
|
184
|
+
Each version is given a distinguishing version number. If the Program
|
185
|
+
specifies a version number of this License which applies to it and "any
|
186
|
+
later version", you have the option of following the terms and conditions
|
187
|
+
either of that version or of any later version published by the Free
|
188
|
+
Software Foundation. If the Program does not specify a version number of
|
189
|
+
this License, you may choose any version ever published by the Free Software
|
190
|
+
Foundation.
|
191
|
+
|
192
|
+
10. If you wish to incorporate parts of the Program into other free
|
193
|
+
programs whose distribution conditions are different, write to the author
|
194
|
+
to ask for permission. For software which is copyrighted by the Free
|
195
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
196
|
+
make exceptions for this. Our decision will be guided by the two goals
|
197
|
+
of preserving the free status of all derivatives of our free software and
|
198
|
+
of promoting the sharing and reuse of software generally.
|
199
|
+
|
200
|
+
NO WARRANTY
|
201
|
+
|
202
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
203
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
204
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
205
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
206
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
207
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
208
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
209
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
210
|
+
REPAIR OR CORRECTION.
|
211
|
+
|
212
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
213
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
214
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
215
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
216
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
217
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
218
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
219
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
220
|
+
POSSIBILITY OF SUCH DAMAGES.
|
221
|
+
|
222
|
+
END OF TERMS AND CONDITIONS
|
data/Manifest.txt
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
BUGS
|
2
|
+
CHANGELOG
|
3
|
+
INSTALL
|
4
|
+
install.rb
|
5
|
+
LICENSE
|
6
|
+
Manifest.txt
|
7
|
+
README
|
8
|
+
Rakefile
|
9
|
+
setup.rb
|
10
|
+
ruby184gc.patch
|
11
|
+
ruby185gc.patch
|
12
|
+
bin/railsbench
|
13
|
+
lib/railsbench/version.rb
|
14
|
+
lib/railsbench/gc_info.rb
|
15
|
+
lib/railsbench/perf_info.rb
|
16
|
+
lib/railsbench/perf_utils.rb
|
17
|
+
lib/railsbench/write_headers_only.rb
|
18
|
+
lib/railsbench/railsbenchmark.rb
|
19
|
+
lib/benchmark.rb
|
20
|
+
script/perf_bench
|
21
|
+
script/perf_comp
|
22
|
+
script/perf_comp_gc
|
23
|
+
script/perf_diff
|
24
|
+
script/perf_diff_gc
|
25
|
+
script/perf_html
|
26
|
+
script/perf_loop
|
27
|
+
script/perf_plot
|
28
|
+
script/perf_plot_gc
|
29
|
+
script/perf_prof
|
30
|
+
script/perf_run
|
31
|
+
script/perf_run_gc
|
32
|
+
script/perf_tex
|
33
|
+
script/perf_times
|
34
|
+
script/perf_times_gc
|
35
|
+
script/run_urls
|
36
|
+
config/benchmarking.rb
|
37
|
+
config/benchmarks.rb
|
38
|
+
config/benchmarks.yml
|
data/README
ADDED
@@ -0,0 +1,254 @@
|
|
1
|
+
Railsbench is a small collection of ruby and shell scripts which make
|
2
|
+
measuring raw performance of rails apps a snap. All tests are run from
|
3
|
+
the command prompt making performance regression testing easy.
|
4
|
+
|
5
|
+
In addition, a patch for the ruby garbage collector is provided, which
|
6
|
+
can be used to reduce the amount of time spent doing garbage
|
7
|
+
collection, trading memory for speed, as usual (see file GCPATCH for
|
8
|
+
details). In addition, applying the patch will enhance performance
|
9
|
+
data obtained from the various scripts (and some won't run at all
|
10
|
+
without the patch).
|
11
|
+
|
12
|
+
This software was written and conceived by Stefan Kaes. The author can
|
13
|
+
be reached via email: <skaes@gmx.net>. Please send comments, bug
|
14
|
+
reports, patches or feature requests to this address.
|
15
|
+
|
16
|
+
|
17
|
+
FILES
|
18
|
+
|
19
|
+
railsbench.rb
|
20
|
+
- defines classes RailsBenchmark and RailsBenchmarkWithActiveRecordStore
|
21
|
+
switches:
|
22
|
+
-gcXXX : perform gc after XXX requests
|
23
|
+
-log[=level] : turn on rails logging (at given level)
|
24
|
+
-nochache : turn off rails caching
|
25
|
+
-path : print $: after loading rails and exit
|
26
|
+
|
27
|
+
config/bechmarks.yml
|
28
|
+
- specification of urls to benchmark
|
29
|
+
install into $RAILS_ROOT/config
|
30
|
+
|
31
|
+
config/benchmarks.rb
|
32
|
+
- defines constant RAILSBENCH which is used by script perf_bench
|
33
|
+
modify this to add custom argument processing
|
34
|
+
install to $RAILS_ROOT/config
|
35
|
+
|
36
|
+
perf_bench n options
|
37
|
+
- main ruby script to run a given benchmark
|
38
|
+
switches (in addition to railsbench switches):
|
39
|
+
-mix : alternates urls in given benchmark
|
40
|
+
|
41
|
+
run_urls n options
|
42
|
+
- run a given benchmark (without benchmarking)
|
43
|
+
useful for checking response codes, like so:
|
44
|
+
|
45
|
+
run_urls 1 -bm=all | grep Status:
|
46
|
+
|
47
|
+
switches as for perf_bench plus
|
48
|
+
-warmup : run all uris once before measuring
|
49
|
+
-svlPV : run test using SVL Ruby Performance Validator
|
50
|
+
-svlMV : run test using SVL Ruby Memory Validator
|
51
|
+
|
52
|
+
perf_run n [ option-string [ config-name ] ]
|
53
|
+
- run a given benchmark, store performance data in a file
|
54
|
+
in directory $RAILS_PERF_DATA and print results
|
55
|
+
|
56
|
+
perf_diff n common-options option-string1 option-string2 [ config-name1 [ config-name2 ] ]
|
57
|
+
- run a given benchmark with two different sets of arguments
|
58
|
+
store data into directory $RAILS_PERF_DATA and print
|
59
|
+
comparison data
|
60
|
+
|
61
|
+
perf_loop n options
|
62
|
+
- used by perf_run and perf_diff
|
63
|
+
calls perf_bench $RAILS_PERF_RUNS times
|
64
|
+
|
65
|
+
perf_times file
|
66
|
+
- analyse and print performance data
|
67
|
+
|
68
|
+
perf_comp [-narrow] [-skip_urls] file1 file2
|
69
|
+
- compare two performance data sets and print results
|
70
|
+
-narrow => produce narrow output
|
71
|
+
-skip_urls => don't print url map (use with -narrow)
|
72
|
+
|
73
|
+
perf_html [-nocss] [-gc] [file]
|
74
|
+
- format output taken from perf_comp and produce a HTML table
|
75
|
+
for inclusion in HTML pages. Reads from standard input.
|
76
|
+
options:
|
77
|
+
-noccs suppress css output
|
78
|
+
-notable suppress table output
|
79
|
+
-gc include gc statistics
|
80
|
+
|
81
|
+
perf_run_gc n [ option-string [ config-name ] ]
|
82
|
+
- run a given benchmark, store performance data in a file
|
83
|
+
in directory $RAILS_PERF_DATA and print results
|
84
|
+
- requires Ruby GC patch
|
85
|
+
|
86
|
+
perf_times_gc file
|
87
|
+
- analyse and print garbage collection statistics, which you
|
88
|
+
can produce by running perf_run_gc
|
89
|
+
|
90
|
+
perf_diff_gc n common-options option-string1 option-string2 [ config-name1 [ config-name2 ] ]
|
91
|
+
- run a given benchmark with two different sets of arguments
|
92
|
+
store GC data into directory $RAILS_PERF_DATA and print
|
93
|
+
GC stats comparison using perf_comp_gc
|
94
|
+
- requires Ruby GC patch
|
95
|
+
|
96
|
+
perf_comp_gc file1 file2
|
97
|
+
- compare two GC performance data sets and print results
|
98
|
+
|
99
|
+
perf_prof n [ option-string [ config-name ] ]
|
100
|
+
- run a given benchmark using ruby-prof for profiling,
|
101
|
+
store profile data in a HTML file in directory $RAILS_PERF_DATA
|
102
|
+
file name is computed from date and benchmark name as described above
|
103
|
+
but has a .html extension instead of .txt
|
104
|
+
|
105
|
+
perf_plot n [ options ] file1 file2 ...
|
106
|
+
- plot performance data from raw performance files using gruff
|
107
|
+
see source for options
|
108
|
+
|
109
|
+
ENVIRONMENT
|
110
|
+
|
111
|
+
RAILS_ROOT
|
112
|
+
- must be set to point to your rails app
|
113
|
+
|
114
|
+
RAILS_PERF_DATA
|
115
|
+
- performance data sets will be stored into this directory
|
116
|
+
if not set, $HOME will be used
|
117
|
+
|
118
|
+
RAILS_PERF_RUNS
|
119
|
+
- the number of times perf_loop will run perf_bench on a single invocation
|
120
|
+
if not set, 3 runs will be performed
|
121
|
+
|
122
|
+
RAILS_BENCHMARK_FILE
|
123
|
+
- perf_bench sends its output to this file
|
124
|
+
|
125
|
+
|
126
|
+
USAGE
|
127
|
+
|
128
|
+
The two main scripts are named perf_run and perf_diff.
|
129
|
+
|
130
|
+
perf_run 100
|
131
|
+
|
132
|
+
runs the list of urls named "default" specified in benchmkarks.yml
|
133
|
+
(see below), requesting each url $RAILS_PERF_RUNS * 100 times.
|
134
|
+
|
135
|
+
perf_run 100 "-bm=list -aws"
|
136
|
+
|
137
|
+
runs the benchmark named 'list' and passes the expanded second
|
138
|
+
argument to the rails app. By processing arguments inside your
|
139
|
+
environment.rb file, you can set performance affecting options. For
|
140
|
+
example, you could load action web service only if -aws is passed and
|
141
|
+
measure the performance effect of omitting it.
|
142
|
+
|
143
|
+
Benchmark data is stored in directory $RAILS_PERF_DATA, which should
|
144
|
+
be set in your environment. If not set, $HOME is used. By default,
|
145
|
+
data is stored in file $RAILS_PERF_DATA/perf_run.$BENCHMARK.txt, where
|
146
|
+
BENCHMARK will be set according to the -bm option.
|
147
|
+
|
148
|
+
perf_run 100 "-bm=index -mail" mail
|
149
|
+
|
150
|
+
will store benchmark data in file
|
151
|
+
|
152
|
+
$RAILS_PERF_DATA/`current-date�.index.mail.txt.
|
153
|
+
|
154
|
+
You can get nicely formatted output of benchmark data by running
|
155
|
+
|
156
|
+
perf_times file
|
157
|
+
|
158
|
+
Script perf_run will automatically print the obtained data after
|
159
|
+
finishing the run using perf_times.
|
160
|
+
|
161
|
+
Script perf_diff runs a list of urls with two different option lists. So
|
162
|
+
|
163
|
+
perf_diff 100 "-bm=blogs -mysql_session" "-mail=0" "-mail=1" cf1 cf2
|
164
|
+
|
165
|
+
would run benchmark 'blogs' twice, first as
|
166
|
+
|
167
|
+
perf_run 100 "-bm=blogs -mysql_session -mail=0" cf1
|
168
|
+
|
169
|
+
and then
|
170
|
+
|
171
|
+
perf_run 100 "-bm=blogs -mysql_session -mail=1" cf2
|
172
|
+
|
173
|
+
printing a comparison of the bechmark data obtained after finishing
|
174
|
+
the second run. cf1 and cf2 can be omitted, in which case data is
|
175
|
+
stored in $RAILS_PERF_DATA/perf_run1.$BENCHMARK.txt and
|
176
|
+
$RAILS_PERF_DATA/perf_run2.$BENCHMARK.txt.
|
177
|
+
|
178
|
+
Script perf_bench can also be invoked manually to run a given
|
179
|
+
benchmark like so:
|
180
|
+
|
181
|
+
perf_bench 100 -bm=blogs -mysql_session -mail=1 >/dev/null
|
182
|
+
|
183
|
+
Performance data is sent to $RAILS_BENCHMARK_FILE, HTML output ends up
|
184
|
+
on stdout. If RAILS_BENCHMARK_FILE is not set, performance data is
|
185
|
+
sent to stderr.
|
186
|
+
|
187
|
+
Scripts perf_run_gc and perf_times_gc can be used to analyse GC performance:
|
188
|
+
|
189
|
+
perf_run_gc 100 "-bm=all -lib=stable11" gc.log
|
190
|
+
perf_times_gc gc.log
|
191
|
+
|
192
|
+
It will produce output looking like this:
|
193
|
+
|
194
|
+
GC data file: d:/perfdata/xp/perf_run.uncached.gc.txt
|
195
|
+
|
196
|
+
collections : 40
|
197
|
+
garbage total : 8188429
|
198
|
+
gc time total (sec) : 4.03
|
199
|
+
garbage per request : 2047.11
|
200
|
+
requests per collection: 100.00
|
201
|
+
|
202
|
+
mean stddev% min max
|
203
|
+
gc time(ms): 101.38 10.0 93.00 125.00
|
204
|
+
heap slots : 400000.00 0.0 400000.00 400000.00
|
205
|
+
live : 192914.31 0.2 191787.00 193197.00
|
206
|
+
freed : 207085.69 0.2 206803.00 208213.00
|
207
|
+
freelist : 0.00 0.0 0.00 0.00
|
208
|
+
|
209
|
+
Note that these numbers, especially requests per collection, are only
|
210
|
+
an approximation. This is due to the fact that run_urls will add one
|
211
|
+
final garbage collection call at the end of the run. Of course, higher
|
212
|
+
number of iterations will produce more accurate data. Also, if the
|
213
|
+
benchmark lists several uris, garbage per request will not give you
|
214
|
+
meaningful information.
|
215
|
+
|
216
|
+
|
217
|
+
CONFIGURATION
|
218
|
+
|
219
|
+
Benchmarks are configured through file benchmarks.yml. Example:
|
220
|
+
|
221
|
+
default:
|
222
|
+
index, other
|
223
|
+
|
224
|
+
index:
|
225
|
+
uri: /test/index
|
226
|
+
new_session: true
|
227
|
+
|
228
|
+
other:
|
229
|
+
-
|
230
|
+
uri: /test/list
|
231
|
+
-
|
232
|
+
uri: /test/alphabetic
|
233
|
+
query_params: page=7
|
234
|
+
|
235
|
+
defines 3 benchmarks:
|
236
|
+
|
237
|
+
"other" consists of 2 urls (/test/list and /test/alphabetic)
|
238
|
+
"index" will run (/test/index)
|
239
|
+
"default" will run all urls in "index" and "other"
|
240
|
+
|
241
|
+
uri: is mandatory, query_params: and new_session: are optional.
|
242
|
+
|
243
|
+
Instead of
|
244
|
+
|
245
|
+
uri: /test/alphabetic
|
246
|
+
query_params: page=7
|
247
|
+
|
248
|
+
one could have written
|
249
|
+
|
250
|
+
uri: /test/alphabetic?page=7
|
251
|
+
|
252
|
+
new_session: specifies whether a session cookie is sent with the
|
253
|
+
request (default). To make this work correctly, you need to set
|
254
|
+
session_data on the benchmarker instance. See benchmarks.rb for details.
|