There is a built-in ab command in Apache to test the pressure of the service, while nginx does not have its own command, so it must be tested with third-party software. Today, I will briefly introduce the stress test of nginx by webbench. The stress test is for system management. It is necessary for personnel and operation and maintenance personnel, and can clearly see how much pressure the server can withstand. Note: I am doing the test on a virtual machine.
Prerequisite: Install the compilation tools
yum install ctags wget make apr* autoconf automake gcc gcc-c++
1. Download webbench software and install
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz or direct download from Baidu cloud disk
tar xvf webbench-1.5.tar.gz -C / usr / local /
cd /usr/local/webbench-1.5/
make
make install
2. Command details
[root@CentOS179min webbench-1.5]# ./webbench -help
webbench [option]... URL
-f|--force Don't wait for reply from server.
-r|--reload Send reload request - Pragma: no-cache.
-t|--time <sec> Run benchmark for <sec> seconds. Default 30.
-p|--proxy <server:port> Use proxy server for request.
-c|--clients <n> Run <n> HTTP clients at once. Default one.
-9|--http09 Use HTTP/0.9 style requests.
-1|--http10 Use HTTP/1.0 protocol.
-2|--http11 Use HTTP/1.1 protocol.
--get Use GET request method.
--head Use HEAD request method.
--options Use OPTIONS request method.
--trace Use TRACE request method.
-?|-h|--help This information.
-V|--version Display program version.
[root@centos179min webbench-1.5]#
3. Test website stress
[root @ centos179min webbench-1.5] # ./webbench -c 200 -t 10 http://192.168.1.179/test.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php
200 clients, running 10 sec.
Speed=58386 pages/min, 51328516 bytes/sec. --Number of response requests per second: Speed=58386 pages/min, amount of data transmitted per second: 51328516 bytes/sec
Requests: 9731 susceed, 0 failed. --10 seconds 200 client requests did not fail
[root @ centos179min webbench-1.5] # ./webbench -c 1000 -t 10 http://192.168.1.179/test.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php
1000 clients, running 10 sec.
Speed=47916 pages/min, 42126676 bytes/sec.
Requests: 7986 susceed, 0 failed. --1000 client requests in 10 seconds did not fail
[root @ centos179min webbench-1.5] # ./webbench -c 2000 -t 10 http://192.168.1.179/test.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php
2000 clients, running 10 sec.
Speed=50394 pages/min, 44303164 bytes/sec.
Requests: 8399 susceed, 0 failed. -- 2000 requests within 10 seconds did not fail
[root @ centos179min webbench-1.5] # ./webbench -c 4000 -t 10 http://192.168.1.179/test.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php
4000 clients, running 10 sec.
Speed=46644 pages/min, 40894852 bytes/sec.
Requests: 7749 susceed, 25 failed. --There are 25 failures when 4000 clients send requests within 10 seconds, which proves that the concurrency does not exceed 4000 in 10 seconds. Note that nginx is not worried change[root@ centos179min
webbench-1.5]#
WebBench installation and testing http://www.linuxidc.com/Linux/2013-04/83586.htm
Test website load with WebBench http://www.linuxidc.com/Linux/2013-03/80612.htm
Website stress testing tool WebBench http://www.linuxidc.com/Linux/2013-01/77510.htm
Installation and use of WebBench, a server stress testing tool http://www.linuxidc.com/Linux/2012-08/69400.htm
Download and install the website stress testing tool WebBench under Linux http://www.linuxidc.com/Linux/2011-02/31995.htm
Two concurrent testing tools in Linux ab&WebBench http://www.linuxidc.com/Linux/2011-01/31392.htm
Use Nginx to build a WEB serverhttp ://www.linuxidc.com/Linux/2013-09/89768.htm
The whole process of building a web server based on Linux6.3+Nginx1.2+PHP5+MySQL5.5http: //www.linuxidc.com/Linux/2013-09/89692.htm
Detailed introduction of Nginx : please click here
Nginx download address : please click here
This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-10/107611.htm