HTTPERF is your friend

December 13, 2009

Performance tools are a great help for testing your web application deployment setup. They not only let you judge how the performance of the application is but also catch errors. Nobody wants a web application which starts to spit out errors when put under load or worse, randomly!

HTTPERF is a gift from HP which is my favourite tool at the moment.

An example httperf usage is:

httperf --num-conns=800 --rate=80 --timeout=5 --server=google.com --port=80 --uri=/

This hits the google homepage with 80 requests per second for 800 requests in total. This test will run for circa 10 seconds.

Results are as follows:

Total: connections 800 requests 800 replies 800 test-duration 10.252 s

  Connection rate: 78.0 conn/s (12.8 ms/conn, <=25 concurrent connections)
  Connection time [ms]: min 140.1 avg 237.1 max 771.7 median 240.5 stddev 40.5
  Connection time [ms]: connect 111.2
  Connection length [replies/conn]: 1.000

  Request rate: 78.0 req/s (12.8 ms/req)
  Request size [B]: 63.0

  Reply rate [replies/s]: min 76.2 avg 77.9 max 79.6 stddev 2.4 (2 samples)
  Reply time [ms]: response 125.9 transfer 0.0
  Reply size [B]: header 280.0 content 219.0 footer 0.0 (total 499.0)
  Reply status: 1xx=0 2xx=0 3xx=800 4xx=0 5xx=0

  CPU time [s]: user 0.51 system 9.64 (user 5.0% system 94.1% total 99.0%)
  Net I/O: 42.8 KB/s (0.4*10^6 bps)

  Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
  Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

This line below is important:

Reply rate [replies/s]: min 76.2 avg 77.9 max 79.6 stddev 2.4 (2 samples)

It tells us that the avg requests per second is 77.9. There is a low standard deviation, which is good. If you have a high stddev you should be worried. Lastly, it has calculated this using 2 samples. You can increase the number of samples by increasing the num-conns, which will give you a more reliable dataset.

Watch out for the errors:

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
  Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

Looking good, google is performing well on the error front. Obviously google.com handles more than 80 req/s! Now go away and performance test some of your sites!

There is some valuable further watching to be had. Episodes 15 and 16 mention httperf.