Apache Benchmarking

The Goal of Benchmarking

The goal of doing benchmark tests is to see what the practical configuration would be for Apache. Specifically, what settings to use primarily for MaxClients, which is maximum number of concurrent connections allowed. MaxRequestsPerChild could be changed as well.

Using ab

You can use ab to do simple benchmark tests, and even have them output to a CSV file.

An example, that uses 25 concurrent connections, runs tests until it does 1,500 requests, keep-alive is turned on, and outputs to a CSV file:

ab -c 25 -v -k -n 1500 -e /tmp/output.csv  http://localhost/

Howto Run a Benchmark Test

Before you do any tests suites, use CGP to determine that average number of webserver connections over a specific period of time (week, month, etc.). Then use that average as the number of concurrent connections, to simulate the benchmark under normal conditions.

Once you have the average number of connections, you can simulate the load under any length of time. Fifteen seconds (one quarter of a minute) is a good number that is both realistic in simulation as well as wait time for the tester.

Simulating the average number of connections (5) over 15 seconds.

ab -c 5 -t 15 -v -k http://localhost/

Please note that in benchmarking, timeout (-t 15) and number of requests (-n 65) are mutually exclusive. Pick one. :)

Running a test over a period of time is probably going to be easier to see, as you can watch the results in realtime with the system load. The opposite, using a number of requests, would be good if you wanted to simulate a sudden spike.