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?)
Turn off throttling by setting Outbound Bandwidth (WebAdmin Console > Configuration > Server > Security) to “0”.
Set Max Keep-Alive Requests (WebAdmin Console > Configuration > Server > Tuning) to a big number, like 100,000.
Set Max Connections (WebAdmin Console > Configuration > Server > Tuning) as high as possible.
Set Connection Soft Limit and Connection Hard Limit (WebAdmin Console > Configuration > Server > Security) to 1000 or higher, depending on how many concurrent connections you need from one IP address.
Set Follow Symbolic Link to “Yes” and Restrained to “No” for the test virtual hosts you will be using. (WebAdmin Console > Configuration > Virtual Hosts > Basic)
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.
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.
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.
These tools will give various output, but, generally, people are most interested in the number of requests per second and the total data transferred.
Even better than using a program to simulate requests to a server is performing the test over LAN
using two or more computers. In order to be sure you're testing the performance of the web server, though, you need to make sure that the network and the client machines do not become a bottleneck. Perform the test on a gigabit LAN
or multiple switched 100Mb connections and, if you use only one machine to simulate the many clients accessing the site, make sure that this machine has power equal to or greater than the server machine.
Once you feel you've got the hang of it, post your results for others to see and comment on. We especially suggest our forum