How much user traffic a website or blog can actually handle is often the top concern when we set up a site using a VPS or dedicated server. Many people also like to tweak LNMP or LAMP stacks to improve web performance. But to see how effective those optimizations really are, we need to perform server stress testing on our sites.
Currently, Webbench, Apache Bench, and http_load are three popular server stress testing tools for web performance. They are all very easy to install and use. As long as you have a VPS or even just your local computer, you can start testing. Due to various factors like network conditions, the test results may not be perfectly accurate, but they can serve as a useful reference.
Apache Bench, also known as AB, is a small tool bundled with Apache specifically designed for HTTP Server benchmark testing. The ab command creates numerous concurrent access threads, simulating multiple visitors accessing a specific URL simultaneously. It can be used to test the load pressure on Apache, and can also test other web servers like Nginx, Lighthttp, and IIS.
Webbench is a website stress testing tool developed by Lionbridge. It can test the pressure on servers running ASP, PHP, JAVA, CGI, and can also test the load capacity of SSL-secured websites. It supports up to 30,000 concurrent connections to test a website’s load capacity. Webbench is simple to operate, displaying server pressure with just a single command line.
http_load is a performance testing tool developed by a foreign blogger based on the Linux platform. It primarily operates by running parallel multiplexed connections to test a web server’s throughput and load, delivering clear, at-a-glance results. For Apache Bench, Webbench, and http_load, you must determine the testing parameters based on the performance of the testing host itself to avoid crashing it.
For those who don’t have their own web server yet, you can use the following software to set up a website server locally or on a remote host:
Server Stress Web Performance Testing: Installing and Using Apache Bench, Webbench, and http_load
1. Apache Bench: The Server Stress Testing Tool Built into Apache
1. To use the Apache Bench tool, you just need Apache on your VPS host. If you need to install Apache, you can run the command directly: yum install httpd.
2. Apache Bench tool usage command: ab -n 100 -c 50 http://www.qq.com/, where “-n” indicates the number of requests per session (default max is 1024), and “-c” indicates the number of concurrent connections for one request (default maximum cannot exceed 50000). Note the C
3. The command above simulates 50 concurrent connections, each with 100 requests, to test the web performance of Tencent’s website. Please see the image below for test results and related data explanations: (click to enlarge)
4. To avoid inaccurate server stress test results due to network issues, you can generally use ab -n 100 -c 50 http://127.0.0.1/index.php to test your own server’s web performance.
5. The website server being tested can view the access records from the Apache Bench tool in its logs. (click to enlarge)
2. Webbench: Stress Testing with Up to 30,000 Concurrent Connections
1. Webbench can simulate up to 30,000 concurrent connections to test server stress, and you can set the stress test duration and success rate of test requests. Command to install Webbench:
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gztar zxvf webbench-1.5.tar.gzcd webbench-1.5make && make install
2. If you encounter errors, run the installation: yum install ctags and yum install gcc. If a file path not found error appears, execute: mkdir -m 644 -p /usr/local/man/man1
3. The Webbench test command is: webbench -c 100 -t 10 http://www.qq.com/index.php, where -c is the concurrency level and -t is the test run time, meaning testing with 100 requests per second over a 10-second period.
4. This is the result of a Webbench test run. Speed shows the number of response requests per minute and the amount of data transferred per second, while Requests shows the number of successful and failed requests.
5. Check the server logs, and you can see records of the Webbench visits.
6. To accurately determine the server’s capacity, gradually increase the concurrency level during testing. For example, observe the website load and page loading smoothness at 100 concurrent connections; note the concurrency level when the site starts to slow down, and again when the site becomes inaccessible.
3. http_load:Testing Web Server Throughput and Load
1. http_load is a Linux-based performance testing tool written by a blogger overseas. It is compact and lightweight, less than 100KB after decompression. Download and installation method:
wget http://acme.com/software/http_load/http_load-12mar2006.tar.gztar xzvf http_load-12mar2006.tar.gzcd http_load-12mar2006mkdir /usr/local/manmake && make install
2. If you encounter errors, you can install: yum -y install gcc gcc-c++
3. Before testing, first enter the directory: cd http_load-12mar2006, then execute: vi url, enter the domain name URL you want to test, save and exit.
4. The command format for http_load testing is: ./http_load -p 100 -s 10 url , -p indicates the number of concurrent processes, -s indicates the duration. This command means initiating requests with 100 concurrent processes each time within 10 seconds.
5. Here is the result demonstration after running http_load:
6. Explanation of relevant http_load parameters is as follows:
[root@None http_load-12mar2006]# ./http_load -p 100 -s 10 url495 fetches, 100 max parallel, 2.24393e+07 bytes, in 10.0022 secondsTotal connection requests: 495, Max concurrent threads: 100, Duration: 10.0022 seconds, Total transfer rate: 2.24393e+07 bytes45332 mean bytes/connectionAverage data amount per connection request49.4891 fetches/sec, 2.24344e+06 bytes/secConnection requests responded per second, Data transferred per secondmsecs/connect: 112.466 mean, 157.051 max, 103.031 minAverage connection response time, Maximum time, Minimum timemsecs/first-response: 1053.73 mean, 2466.83 max, 179.647 minAverage first-byte return time per connection, Maximum, Minimum.HTTP response codes: code 200 -- 495HTTP return codes: 200, Total: 495 times.
7. In the test results, mainly refer to the fetches/sec and msecs/connect values, which measure the server’s performance by the number of queries it can respond to per second.
4. Summary of Server Stress Web Performance Testing
2. Of course, judging solely by the numerical values is not accurate; you also need to consider CPU, memory consumption, and other factors comprehensively. You should also be cautious when using these three tools yourself, to avoid sending too much load at once, which could cause the target server to crash directly due to memory







