Browsing articles in "Projects"
Aug 2, 2010
Usu

ApacheBench Script

Quoting from Apache Benchmark official website:

ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs.

In order to make sure that a benchmark involving the use of ApacheBench is run without any distortion due to, for example, wait times that could lead to cache expiration I needed a very simple bash script, so here it is:

#!/bin/bash
NUM=1250
CONC=3
SLEEP=15
FILENAME=Benchmark
URL=http://www.example.com/
echo "a started"
ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-a.txt
echo "a completed"
sleep $SLEEP
echo "b started"
ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-b.txt
echo "b completed"
sleep $SLEEP
echo "c started"
ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-c.txt
echo "c completed"
sleep $SLEEP
echo "d started"
ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-d.txt
echo "d completed"
sleep $SLEEP
echo "e started"
ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-e.txt
echo "e completed"
exit 0