The Apache service comes with the tool AB (Apachebench) that should be used for stress testing, which is perfectly capable of doing some simple stress tests, this article mainly introduces, in the case of CentOS without Apache installation, install AB
1,ab runtime needs to rely on the package, we first install the dependency package, direct Yum installation can be
Yum Install Apr-util
2, download Apache RPM package, detach AB
[[email protected] ~]# mkdir ab[[email protected] ~]# CD Ab[[email protected] ab]# yum-y install Yum-utils[[email Protect Ed] ab]# Yumdownloader httpd #yumdownloader need to install Yum-utils to use, default is not installed [[email protected] ab]# Rpm2cpio httpd-2.2.3-91.el5.centos.i386.rpm |cpio-idmv[[email protected] ab]# \cp-pa usr/bin/ab/usr/bin/#复制到系统PATH就可以使用了
3,ab Simple usage
A lot of parameters, generally we use the-C and-n parameters can be.
#ab-C 1000-n 4000 http://www.yousite.com/index.html #具体到某页面
The 4000 after-N represents a total of 4,000 requests, and the 1000 after-c indicates 1000 concurrency (simulating 1000 simultaneous accesses), followed by URLs representing the target URLs of the tests.
[[email protected] ab]# ab -c 1000 -n 4000 http://192.168.0.222/docs/ manager-howto.htmlthis is apachebench, version 2.0.40-dev < $Revision: 1.146 $> apache-2.0Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Copyright 2006 The Apache Software Foundation, http:// www.apache.org/benchmarking 192.168.0.222 (be patient) completed 400 requestscompleted 800 requestscompleted 1200 requestscompleted 1600 requestscompleted 2000 requestsCompleted 2400 requestsCompleted 2800 requestsCompleted 3200 requestscompleted 3600 requestsfinished 4000 requestsserver software: nginx/1.4.3Server Hostname: 192.168.0.222server  port: 80document path: /docs/manager-howto.htmlDocument Length: 73924 bytesConcurrency Level: 1000time taken for tests: 0.875928 secondscomplete requests: 4000Failed requests: 0write errors: 0total transferred: 296732000 bytesHTML transferred: &NBSP;&NBSP;295696000&NBSP;BYTESREQUESTS&NBSP;PER&NBSP;SECOND:&NBSP;&NBSP;&NBSP;&NBSP;4566.59&NBSP;[#/SEC] (mean) #最重要的指标之一, equivalent to the number of transactions per second in LR, the mean in parentheses indicate that this is an average, the greater the pressure is stronger time per request: 218.982 [ms] (mean) #最重要的指标之二, equivalent to the average transaction response time in LR, followed by a mean in parentheses indicating that this is an average time per request: 0.219 [ms] (mean, across all concurrent Requests) Transfer rate: 330822.86 [kbytes /sec] received# average per second network traffic, throughput, greater compressive strength connection times (ms) min mean[+/-sd] median maxconnect: 0 0 4.5 0 29Processing: 1 17 14.5 17 653waiting: 0 17 14.5 17 653total: 15 18 15.2 17 674Percentage of the requests served within a certain time (MS) 50% 17 66% 18 75% 18 80% 18 90% 20 95% 22 98% 37 99% 40 100% 674 (Longest request)
The main introduction of the inside of several indicators, I basically look at these indicators, simple test enough, if you want to fully monitor nginx, need to use professional monitoring procedures, such as Nagios
Centos Web Stress test Tool Apachebench (AB) Standalone installation