Table of Contents

I want to compare the performance of different web servers. How do I perform a benchmark?

Glad to hear you're interested. We always welcome new benchmarks. Here are some tips on carrying out a meaningful test. This is not a complete, step-by-step guide. Becoming good at benchmarking often requires a lot of trial, so you need to get your hands dirty to learn.

Tune up the web server

The first thing to do is to make sure your web server is tuned up for maximum performance: (We want to see how fast we can go, right?)

Run a benchmarking tool

There are many, many tools to choose from. Here we will address ApacheBench and httperf because they are two of the most commonly used tools and we are familiar with them.

Using ApacheBench: ApacheBench is a command line performance-testing tool bundled with Apache httpd. It can simulate hundreds of HTTP/1.0 clients simultaneously accessing the same resource on a server. You can run it with the command:

ab -n 10000 -c 100 http://localhost:8088/index.html

The number after -n stipulates the number of requests and -c stipulates the concurrency. You can make the requests keep-alive by adding a -k after the concurrency. For more detailed information, please check the Apache documentation.

Using httperf: You can get httperf from https://code.google.com/p/httperf/. Httperf uses HTTP/1.1 protocol by default and always uses keep-alive requests. Here is an example command:

./httperf --server localhost --port 8088 --uri /index.html --rate 1000 --num-conn 100 --num-call 100 --timeout 50

httperf has more command options. For more detailed information, please refer to its documentation.

Tips