We know that there are indeed a lot of stress testing software, such as Microsoft's wast, HP's LoadRunner, and so on, but it still takes some time to learn these software, and it is a headache to choose it, later, on GUO Xin's "Building a high-performance web site", he saw the Apache stress testing tool AB, which he introduced, so today, we finally have the opportunity to experience AB's stress testing on the website.
Before the experiment, My Apache has been installed. Operating System: Ubuntu 10.04 VMware 7.0
1. First check the version information AB-V (note that it is an uppercase V)
- [Email protected]: ~ $ AB-V
- This is apachetings, Version 2.3 <$ revision: 655654 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to the Apache Software Foundation, http://www.apache.org/
2. You can also use lower-case V to view some AB-V attributes of the AB command.
- [Email protected]: ~ $ AB-V
- AB: option requires an argument -- V
- AB: Wrong number of arguments
- Usage: AB [Options] [http [s]: //] hostname [: Port]/path
- Options are:
- -N requests number of requests to perform
- -C concurrency number of multiple requests to make
- -T timelimit seconds to max. Wait for responses
- -B windowsize size of TCP send/Receive Buffer, in bytes
- -P postfile file containing data to post. Remember also to set-T
- -U putfile file containing data to put. Remember also to set-T
- -T 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 attributes
- -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 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 do not show percentiles served table.
- -S do not 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 (see OpenSSL ciphers)
- -F Protocol specify SSL/TLS Protocol (ssl2, ssl3, tls1, or all)
3. Now let's perform a stress test on the 51cto website, use the command AB-n1000-C10 http://www.51cto.com/index.php, where-n1000 represents the total number of requests-C10 represents the number of concurrent users as 10 http://www.51cto.com/index.php represents the request URL, and below is the test result, I have commented out the three most important indicators.
- [Email protected]: ~ $ AB-n1000-C10 http://www.51cto.com/index.php
- This is apachetings, Version 2.3 <$ revision: 655654 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to the Apache Software Foundation, http://www.apache.org/
-
-
- Benchmarking www.51cto.com (Be patient)
- Completed100 requests
- Completed200 requests
- Completed300 requests
- Completed400 requests
- Completed500 requests
- Completed600 requests
- Completed700 requests
- Completed800 requests
- Completed900 requests
- Completed1000 requests
- Finished 1000 requests
-
- /* The Web server uses nginx */
- Server 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
- Failed requests: 0
- Write errors: 0
- Non-2xx responses: 1000
- Total transferred: 330000 bytes
- HTML transferred: 154000 bytes
- /* One of the most important indicators is the throughput.
- EquivalentTransactions per second, The mean in the following brackets indicates that this is an average value */
- Requests per secondd: 13.45 [#/sec] (mean)
- /* Metric 2, which is the most important indicator, refers to the average user request wait time.
- EquivalentAverage Transaction Response Time, The mean in the following brackets indicates that this is an average value */
- Time per request: 743.726 [MS] (mean)
- /* Metric 3 that everyone cares about most refers to the average Server Request Processing Time
- Time per request: 74.373 [MS] (mean, internal SS all concurrent requests)
- Transfer Rate: 4.33 [Kbytes/sec] canceled ed
-
- 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
- Total: 261 739 1543.7 294
-
- 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. To make the results more comparative, we will change the number of concurrent users to 100 for stress testing. Here I will only post three indicators.
- Requests per secondd: 190.95 [#/sec] (mean)
- Time per request: 523.694 [MS] (mean)
- Time per request: 5.237 [MS] (mean, internal SS all concurrent requests)
5. Change the number of concurrent users to 200 for testing.
- Requests per secondd: 186.00 [#/sec] (mean)
- Time per request: 1149.433 [MS] (mean)
- Time per request: 5.747 [MS] (mean, internal SS all concurrent requests)
6. Situations of 500 concurrent users
- Requests per secondd: 180.99 [#/sec] (mean)
- Time per request: 2631.662 [MS] (mean)
- Time per request: 5.263 [MS] (mean, internal SS all concurrent requests)
Let's analyze the test results. First, compare the throughput. When the number of concurrent users is 190 reqs/s, the maximum throughput is 200,500. When the number of concurrent users is, the throughput is reduced, as a result, the user's waiting time increases significantly, and there is already 2 seconds of waiting time. This shows that the performance has dropped significantly. Of course, the analysis of this test result does not mean that 51cto's website can only send users around 500, because I did the test when the server load is heavy, which obviously cannot explain the problem. In addition, when testing in the production environment, it is best to make the test results into a report, which can clearly compare the problem. Well, I should prepare for it, I submitted a test report for our website.
Stress testing tools