November 10, 2009
If you need to do some performance testing of your web app, one tool that is pretty easy to use is httperf. I recommend watching the Peepcode screencast on httperf to get some good tips on how to doing performance testing. There is also some reading material on httperf created by Ted Bullock available. These are great resources, but here's the quick and dirty on how to get httperf going.
Once you've got it installed, make sure the site you are testing on is running with all the production settings turned on. The Peepcode screencast goes into detail about how to do that for a Rails app. Then, if you are trying to test the
/profile page on
myfancysocialnetwork.com, you would run a command like this:
httperf --server myfancysocialnetwork.com --port 80 --uri /profile --num-conns 100
This will hit the profile page 100 times and report back with statistics like the minimum response time, maximum response time and the average response time, including standard deviation. You will certainly want to adjust the
--num-conns option based on the page you are testing. If it's a pretty slow page with response times over a second or two, then 100 is probably ok. If it's a more well behaved page that renders in a few hundred milliseconds, then a large number like 10000 might be better. The goal is to make sure that it runs long enough to generate enough samples to make the results statistically relevant. You'll also want to read the documentation/watch the screencast to get info on other options like
rate to create different kinds of test scenarios.