RWB, the Ruby Web Bench, provides a simple way to manage a performance and load tests suite for your webserver. Unlike ab, by which it was inspired, it will allow you to build a collection of test URLs with corresponding weights which it will use to generate the actual tests that it runs (and reports on).

RWB could be used for:

- testing your website to ensure that it performs within timing
  requirements 
- testing a new webserver to verify that performance is at least as good
  as your existing server
- testing a website to verify that it will handle expected load

While this is an alpha release, it is already useful. The API is expected to change somewhat as functionality is added and the design is adjusted. Reporting by error type, serializing of results, cookie handling, POST requests, and set_up methods are some of the planned additions before rwb hits a beta release.

A sample RWB script for testing a website looks like this (for more information, see the file USING):

#!/usr/bin/env ruby

require ‘rwb’

urls = RWB::Builder.new()

urls.add_url(10, “www.example.com”) urls.add_url(10, “www.example.com/nonesuch”) urls.add_url(70, “www.example.com/entries”)

queries = [‘foo+bar’, ‘bar+baz’, ‘quux’] urls.add_url_group(10, “www.example.com:3000/search?”, queries)

tests = RWB::Runner.new(urls, 100, 20) tests.report_header tests.report_overall tests.graph_quartiles_urls(1000)

The output from this script looks like this: $ ruby -Ilib quick.rb completed 10 runs completed 20 runs completed 30 runs completed 40 runs completed 50 runs completed 60 runs completed 70 runs completed 80 runs completed 90 runs completed 100 runs Concurrency Level: 20 Total Requests: 100 Total time for testing: 2.021048 secs Requests per second: 49.4792800566835 Mean time per request: 236 msecs Standard deviation: 342 Overall results:

Shortest time:  30 msecs
25.0%ile time:  74 msecs
50.0%ile time:  98 msecs
75.0%ile time:  185 msecs
Longest time:   1281 msecs

localhost:

0:  +-|                                           :1000

localhost/nonesuch:

0: [|+----|                                       :1000

localhost/entries:

0:[ |+--|                                         :1000

localhost:3000/search?:

0:  |------+--------------------------------------:1000

(Additional examples of use can be seen at www.red-bean.com/~pate/