How to Benchmark your Apache Website with siege
and Apache Benchmark (ab) on Linux and FreeBSD
I've recently had to benchmark a website thus I decided to share a
quick way on how you can achieve a general way to benchmark your
webserver configuration and your website responce times while under
heavy loads.
The first and very classical way is to use
ab - the Apache
HTTP server benchmarking tool
To install AB (Apache Benchmark on Debian GNU/Linux it's rather
easy), invoke:
debian-server:~# apt-get install
apache2-utils
On FreeBSD
ab is part of the apache port so you don't need
to install anything extra to start using is.
Further on a very basic way to test your Apache performance would
be:
debian-server:~# ab -n 1000 -c 100
http://yourwebsite.com
The above command would instruct apache benchmark to make
1000
connections to http://yourwebsite.com where the
connection
concurrency would be of 100 parallel connections
Another possible use of
the Apache Benchmark tool could be
for instance:
debian-server:~# ab -kc 20 -t 30
http://yourwebsite.com/
This would instruct apache benchmark to open 20 connections and
keep alive the connecitons sending requests to the Webserver for 30
seconds.
Though using
AB is not a bad way to make a performance
measurement under a certain loads, the results in many cases won't
be completely accurate.
For a bit more accurate performance check results I advice you to
check out
Siege
the HTTP performance stress tester
On FreeBSD - the siege webserver benchmark tool is available via
the ports tree. So the install on FreeBSD is pretty straight
forward with:
freebsd-box# /usr/ports/benchmarks/siege
freebsd-box# make install cleam
Luckily the
siege apache stress tester has a package
available for Debian Linux, so installing if you're following this
article would come to the trivial apt-get install:
debian-server:~# apt-get install siege
On other Linux / Unix platforms you would have to
download the latest siege
source release and compile it via the instructions in the
source archive README file.
Assuming that you succeed in installing siege, next to start using
it in a very simple way to check your Website of Webserver for
performance as well as get some Benchmarking on how it operates
under different amount of user connections you can execute
something like:
debian-server:~# siege -b -c 100 -r 10
http://yourwebsite.com
This will benchmark the
http://yourwebsite.com website
running on top of your webserver of choice, running with 100
concurrent connections to the website, running the test in a loop
10 times.
By default all output from the siege Apache benchmarking tests
would be logged in the ouput file
/var/siege.log
Another handy opportunity
siege provides is the ability to
check a number of provided website url address via the
-f
option.
There possibly a number of other valuable tools to benchmark your
Webserver (Apache or the webserver type you use), however I belive
this twos should be enough for most benchmarkers out there.