However, it is far
beyond this book??™s scope.
162 | Chapter 6: Performance
The benchmarking tool we will be using is Railsbench (http://railsbench.rubyforge.org/)
by Stefan Kaes. This provides some very convenient tools for benchmarking Rails
applications and visualizing the results. Railsbench has a slightly complicated installation
procedure. First, install the gem:
$ sudo gem install railsbench
Next, you should add the directory containing the Railsbench scripts to your PATH,
and make them executable. This can be done as follows:
$ eval `railsbench path`
$ sudo railsbench postinstall
Railsbench looks for some environment variables to know where the Rails application
is and where its data should go, so we need to export those:
$ export RAILS_ROOT=.
$ export RAILS_PERF_DATA=.
Now Railsbench is installed and ready to run. But first, there are some changes we
need to make to the application. We install the Railsbench code into our application:
$ railsbench install
That command provides us with a few files that are used for benchmarking:
config/benchmarks.rb
Railsbench configuration. Use this file to provide Rails with custom session data,
if needed.
config/benchmarks.yml
Defines the set of benchmarks that can be run; each one has a name, URI, HTTP
method, and optional POST data. Most of this file can be generated automatically
from the application??™s routes; we will do this as our next step.
Pages:
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252