A little bit of Ruby for work

I've always used, but never really like ab for looking at Apache performance. The big things that I've wanted to do with it was hit multiple urls according to a defined ratio. After a bit of hacking on the bus, I've got a working kernel (uner 150 lines of Ruby). I can run a script like this:

config = {
"http://localhost/first" => '50',
"http://localhost/second" => '30',
"http://localhost/third" => '20'}
urls = RWBBuilder.new(config)
tests = RWBRunner.new(urls, 10000, 100)

and I'll get back a report like this:

Concurrency Level: 100
Total Requests: 10000
Total time for testing: 48.786909 secs
Requests per second: 204.973018479199
Mean request time: 0.0048786909 secs
Results for http://localhost/first
Numer of runs: 4864
Shortest time: 0.02031 secs
50%ile time: 0.036371 secs
90%ile time: 0.045528 secs
99%ile time: 0.263913 secs
99.9%ile time: 1.555193 secs
Longest time: 1.556691 secs
Results for http://localhost/second
Numer of runs: 3142
Shortest time: 0.021777 secs
50%ile time: 0.035928 secs
90%ile time: 0.045415 secs
99%ile time: 0.289059 secs
99.9%ile time: 1.49962 secs
Longest time: 1.554188 secs
Results for http://localhost/third
Numer of runs: 1988
Shortest time: 0.016705 secs
50%ile time: 0.03639 secs
90%ile time: 0.04559 secs
99%ile time: 1.256631 secs
99.9%ile time: 1.496296 secs
Longest time: 1.544625 secs

Once I get it cleaned up a bit more, I'll release it for general use.

No comments: