BibleGateway.com Verse Of The Day

Wednesday, August 08, 2007

A Few Notes on my Load Tester Ruby Script

A few days ago I posted a Ruby script I use to simulate multiple users hitting a web application. I have a few notes regarding that script:
  1. There is a minor bug in it, that doesn't affect functionality so much as the "logging". I used a global var like a dummy and then reference that in the threads.
  2. I also added a 3rd command line param to tell the script how many times each thread should run through the list of URL's.
  3. I also added a sleep() feature so each thread will pause between each run through the list of URL's. Right now that is just a global var instead of a command line param.
I will have to repost the source to get these changes up here. (Actually the *.rb source file is up, I just haven't regenerated the HTML yet.)

On a related note, I wanted to do a better simulation of the types of requests coming through to our prod box. My clever idea, take the actual requests out of Apache's access_log or (in my case) ssl_request_log.

So how to easily grab all those requests to build my file? The format of my ssl_request_log looks a bit like this (some stuff renamed to protect the innocent):

[08/Aug/2007:14:42:23 -0400] 192.237.32.76 SSLv3 RC4-MD5 "GET /appcontext/en/US/CZN2/css/main.css HTTP/1.1" -

Well I just want the URI starting after the GET, so from the Linux/Unix/Cygwin command line do something like this....
$ cat ssl_request_log | cut -d' ' -f 7 2>&1 | tee URIs.txt
Then in vi, I can just put the "http://myserver" portion of the URL at the beginning of each line with a global replace, and I'll have a file with every request, including those for images, stylesheet *.css files, javascript *.js files, etc.

This is much easier than sitting here trying to piece together URL's by hand.

No comments: