We know that there are really a lot of software for stress testing, such as Microsoft's Wast, HP's LoadRunner, and so on, but the software still takes some time to learn, and it's a real headache to choose from, and later in Guo Xin's "Build a high-performance Web site" Saw his introduction of the Apache with the pressure test tool AB, very much like, so today finally have the opportunity to experience under the AB site stress test. before the experiment, my Apache was installed, operating system: Ubuntu 10.04 VMware 7.0
1, first look at the version information Ab-v (note that the capital of V)
studiogang@studiogang:~$ ab-v This
is Apachebench, Version 2.3 < $Revision: 655654 $>
Copyright 1996 Adam Tw ISS, Zeus Technology LTD, http://www.zeustech.net/
2. We can also use lowercase v to view some of the attributes of the AB command ab-v
studiogang@studiogang:~$ ab-v ab:option requires an argument--v ab:wrong number of arguments usage:ab [options] [http[s]://]hostname[:p Ort]/path Options are:-N requests number of requests to perform-c concurrency number of mul Tiple requests to make-t TimeLimit Seconds to Max. Wait for Responses-b windowsize the Size of TCP send/receive buffer, in Bytes-p postfile File containing the data to POST. Remember also to Set-t-u putfile File containing data to put.
Remember also to set-t-T content-type content-type header for POSTing, eg.
' application/x-www-form-urlencoded ' Default is ' text/plain '-v verbosity how much troubleshooting info to print -W Print out results in HTML tables-i use head instead of get-x attributes String to insert as table attribute S-y attributes string to insert as TR attributes-z attributes string to insert as TD or TH ATTRIBUTES-C attribute ADD cookie, eg. ' Apache=1234. (repeatable)-H attribute Add Arbitrary header line, eg. ' Accept-encoding:gzip ' Inserted after the all normal header lines. (repeatable)-a attribute Add Basic WWW authentication, the attributes are a colon separated username and password
.
-P attribute Add Basic Proxy authentication, the attributes are a colon separated username and password.
-X Proxy:port ProxyServer and port number to Use-v Print version number and exit-k use HTTP KeepAlive feature
-D don't show percentiles served table.
-S don't show confidence estimators and warnings.
-G filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served-r Don ' t exit on socket receive errors. -H Display Usage information (this message)-Z ciphersuite specify SSL/TLS cipher suite-F PR Otocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or all)
3 , now let's do a stress test on the 51CTO site , using the command Ab -n1000 -c10 http://www.. net/index.php , where-n1000 represents the total number of requests-C10 represents 10 concurrent users &NBSP; http://www.. net/index.php represents the URL of the request, the following is the result of the test, where we are most concerned about the three metrics that I have commented out.
studiogang@studiogang:~$ AB-N1000-C10 http://www.51cto.com/index.php This is apachebench, Version 2.3 < $Revision: 6 55654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to the Apache Software Fou Ndation, http://www.apache.org/Benchmarking www.51cto.com (Be patient) Completed requests Completed
TS Completed Requests Completed requests Completed requests Completed requests Completed Completed requests Completed 900 requests Completed 1000 requests finished 1000 requests/*web server with nginx*/S erver Software:nginx Server hostname:www.51cto.com Server port:80 document Path:/index.php document Length : 154 bytes Concurrency level:10 time taken for tests:74.373 seconds Complete requests:1000: 0 Write errors:0 non-2xx responses:1000 total transferred:330000 bytes HTML transferred:154000 Bytes/* Everyone is most concerned about One of the indicators, which means that the throughput is equivalent to the LR per secondThe number of transactions, followed by the mean in parentheses, indicates that this is an average * * * Requests per second:13.45 [#/sec] (mean)/* The two most concerned indicators are the average user request latency equivalent to the average transaction response time in LR, followed by The mean of the number indicates that this is an average/time of request:743.726 [MS] (mean)//* The most concerned index of the three, refers to the average server request processing times per request:74.373 [MS] ( Mean, across all concurrent requests) Transfer rate:4.33 [kbytes/sec] received Connection times (ms) Min mean[ +/-SD] Median max connect:129 163 245.3 145 3154 processing:129 576 1510.8 147 11756 waiting:129 567 1502.0 147 11
756 total:261 739 1543.7 294 11888 Percentage of the requests served within a certain time (ms) 50% 294 66% 297 75% 304
80% 308
90% 1290
95% 3452
98% 7582
99% 7962
100% 11888 (longest request)
4, in order to make the results more comparative, we will change the concurrent user to 100 to carry out the stress test, I only posted three indicators .
Requests per second:190.95 [#/sec] (mean) time/
Request: 523.694 [MS] (mean) time per
request:
5, change the concurrent user to 200 to test
Requests per second:186.00 [#/sec] (mean) time/
Request: 1149.433 [MS] (mean) time per
request:
6, 500 concurrent users
Requests per second:180.99 [#/sec] (mean) time/
Request: 2631.662 [MS] (mean) time per
request:
Let's analyze the results of the test, first compare the throughput, When concurrent users have the highest throughput rate of 190 reqs/s, when the number of concurrent users is 200,500 throughput decreased, the user's waiting time is significantly increased, there is already 2s waiting time. This shows a noticeable decrease in performance. Of course, the analysis of this test results does not mean that 51CTO of the site's concurrent users can only be around 500, because I was in the server load situation on the line test, which clearly does not explain the problem. In addition, we test in the production environment, it is best to make the test results report, so that can be very clear contrast problems, well, I should be prepared to submit a copy of our company's Web site Test report.