if automated load tests are included in a continuous integration environmentthat
is, a repeated series of quality control processes.
The remainder of this section will review available tools for performing load tests,
including how to interpret their output, and provide some associated resources.
For further information on these topics, refer to the excellent benchmark blog post
series written by Paul Jones.
53
ab
ab
54
is a relatively simple benchmarking tool developed as part of the Apache HTTP
server project, and is available in most environments with Apache installed. While
it has a number of parameters with which to tweak how it conducts its tests, three
in particular are used frequently:
1. -c #: number of concurrent requests to make per second, or the number of users
accessing the application simultaneously
2. -n #: number of requests to send
3. -t #: maximum amount of time in seconds to continue testing, assumes -n 50000
So, for example, if you wanted to simulate site activity with 10 concurrent users
for one minute, the command to use would be:
ab -c 10 -t 60 http://localhost/phpinfo.php
ab has a fair bit of output, but this block is most frequently of interest:
Concurrency Level: 10
Time taken for tests: 60.003 seconds
Complete requests: 20238
Failed requests: 0
Write errors: 0
Total transferred: 1502270841 bytes
HTML transferred: 1498403855 bytes
Requests per second: 337.29 [#/sec] (mean)
Time per request: 29.648 [ms] (mean)
53
http://paul-m-jones.com/category/programming/benchmarks
54
http://httpd.apache.org/docs/2.2/programs/ab.html
PHP Master: Write Cutting-edge Code280

Get PHP Master now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.