Web server performance test with ApacheBench

When you set up new web server instance you need to test it’s performance. Same thing when you need to change some option that can directly affect web server performance or you want to make it better. There are a lot of tools available for doing that, but my favorite is ApacheBench.
Basically it is simple tool that is available almost on all Linux distributions like basic package. Usage:

ab [options] [http[s]://]hostname[:port]/path

To perform web server performance test with ApacheBench execute this sample command that will send 1000 requests to the server:

ab -n 1000 http://HOSTNAME:80/

Most used options for ApacheBench are:

-n requests     Number of requests to perform
-c concurrency  Number of multiple requests to make

Also there are useful options like:

-e filename     Output CSV file with percentages served
-X proxy:port   Proxyserver and port number to use
-k              Use HTTP KeepAlive feature

For full list of options use help:

ab -h

I hope it will be useful to know about this great tool.

  • Stefan Sonnenberg-Carstens

    A test like this is next to useless.

    Most of the time it is not apache, nginx or whatever webserver you use that

    causes the problems – it is the application.

    And to test its performance you nee a load generator and a usefull testcase/pattern which you can run (see http://tsung.erlang-projects.org/ for an example for such a tool).

    • Alen Komljen

      I think it’s not so useless, but yes most of the time application causes the problems. Also when I need some testcase I use JMeter tool, which is really great. Anyway thanks for tool you mention, as I didn’t hear about it until now.