Httperf is a tool for measuring web server performance. It provides a flexible facility for generating various HTTP workloads and for measuring server performance.
NOTE : for accurate results, it’s best to run httperf from a remote machine and not from the localhost
to install httperf in red-hat based distributions (additional repo are needed. For centos you’ll need rpmforge, see here for installation)
yum install httperf
or in debian based
apt-get install httperf
An example of httperf stress test
httperf --server www.somedomain.com --uri /index.php --num-conn 20 --num-cal 10 --rate 2 --timeout 5
–server specifies the name or ip of the machine the service is running.
–uri specifies the context path of the service on the server.
–num-conn 20 instructs httperf to make 20 connections.
–num-cal 10 instructs httperf to issue 10 requests per connection.
–rate 2 specifies how many new connections are made every second, 2 in our case.
–timeout 5 instructs httperf to report as errors any requests that aren’t answered within 5 seconds.
So with the above command we’ll open 20 connections (with a rate of 2 connections per second) to http://www.somedomain.com/index.php with 10 requests per connection. Any requests that aren’t answered by the web server within 5 seconds will be marked as error.
Of course you should set different options for a static .html page against a cms like joomla,wordpress, drupal etc. Different options should also be used for a vps against a dedicated server.
I would suggest to start testing with something that your web server could handle easily and start raising values afterwards. Setting too high options from the beginning might cause high load to your server and make it unresponsive.
For further customization you should visit the man page of httperf.
An example of the results :
[root@server ~]# httperf --server www.somedomain.com --uri / --num-conn 20 --num-cal 10 --rate 2 --timeout 5 httperf --timeout=5 --client=0/1 --server=www.somedomaincom --port=80 --uri=/ --rate=2 --send-buffer=4096 --recv-buffer=16384 --num-conns=20 --num-calls=10 Maximum connect burst length: 1 Total: connections 20 requests 200 replies 200 test-duration 10.542 s Connection rate: 1.9 conn/s (527.1 ms/conn, <=3 concurrent connections) Connection time [ms]: min 1017.6 avg 1055.9 max 1181.1 median 1033.5 stddev 47.2 Connection time [ms]: connect 70.9 Connection length [replies/conn]: 10.000 Request rate: 19.0 req/s (52.7 ms/req) Request size [B]: 63.0 Reply rate [replies/s]: min 18.4 avg 19.2 max 20.0 stddev 1.1 (2 samples) Reply time [ms]: response 73.6 transfer 24.9 Reply size [B]: header 296.0 content 12374.0 footer 0.0 (total 12670.0) Reply status: 1xx=0 2xx=200 3xx=0 4xx=0 5xx=0 CPU time [s]: user 1.86 system 8.30 (user 17.7% system 78.7% total 96.4%) Net I/O: 235.9 KB/s (1.9*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