The AB tool included with Apache (the PHP environment used in this machine is the WAMP integration environment, the AB tool is located in D:\wamp\bin\apache\Apache2.2.21 \ Bin) is very easy to use, AB can launch test requests locally directly on the Web server, which is critical , because sometimes we need to test only the server's processing performance, and do not want to be doped with the impact of network transmission time. AB for all the nature of testing is based on HTTP, so it can be said that AB for the Web server Software black box performance testing, all the data obtained and calculation results can be explained by HTTP.
The AB tool included with Apache (the PHP environment used in this machine is the WAMP integration environment, the AB tool is located in D:\wamp\bin\apache\Apache2.2.21 \ Bin) is very easy to use, AB can launch test requests locally directly on the Web server, which is critical , because sometimes we need to test only the server's processing performance, and do not want to be doped with the impact of network transmission time. AB for all the nature of testing is based on HTTP, so it can be said that AB for the Web server Software black box performance testing, all the data obtained and calculation results can be explained by HTTP.
Test that the machine correctly installs the AB tool, where the power Shell wants to locate the current directory to bin, enter the. \ab–v command, and if the installation is correct, print out its version information.
PS d:\wamp\bin\apache\apache2.2.21\bin>. \ab-v
This is apachebench, Version 2.3 < $Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, Http://www.zeustech
Licensed to the Apache software Foundation, <a href= "http://www.apache.org/" >http://www.apache.org/</a>
Okay, everything's ready. Here is an example of a stress test:
Input command PS d:\wamp\bin\apache\apache2.2.21\bin>. \AB-N1000-C10 http://localhost/index.php
This is apachebench, 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 localhost (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:apache/2.2.21
Server Hostname:localhost
Server port:80
Document Path:/index.php
Document length:211 bytes
Concurrency level:10
Time taken for tests:0.496 seconds
Complete requests:1000
Failed requests:0
Write errors:0
Non-2xx responses:1000
Total transferred:400000 bytes
HTML transferred:211000 bytes
Requests per second:2015.93 [#/sec] (mean)
Time per request:4.960 [MS] (mean)
Time per request:0.496 [MS] (mean, across all concurrent requests)
Transfer rate:787.47 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 0 0.4 0 1
Processing:2 5 1.1 4 12
Waiting:2 4 1.1 4 12
Total:2 5 1.1 5 12
Percentage of the requests served within a certain time (MS)
50% 5
66% 5
75% 5
80% 6
90% 6
95% 7
98% 8
99% 9
100% (Longest request)
The following begins parsing this command statement: Start AB and enter and exit three parameters (PS d:\wamp\bin\apache\apache2.2.21\bin>. \AB-N1000-C10 http://localhost/index.php)
-n1000 indicates that the total number of requests is 1000
-C10 indicates that the number of concurrent users is 10
http://localhost/index.php indicates the destination URL for this write request
The test results are also at a glance and the throughput rate tested is: Requests per second:2015.93 [#/sec] (mean) There is some other information out there for the first time.
Server software represents the Web server software name being tested
Server Hostname represents the requested URL host name
Server port indicates the listening port of the Web server software being tested
Document path represents the root absolute path in the requested URL, and with the suffix of the file, we can generally understand the type of the request
Document length indicates the body size of the HTTP response data
Concurrency level represents the number of concurrent users, which is one of the parameters we set
Time taken for tests indicates the total amount of times that all these requests have been processed to complete
Complete requests represents the total number of requests, which is one of the parameters we set
Failed requests represents the number of failed requests, where the failure is the case where the request is in connection with the server, sending data, and so on, and when there is no response time out. If the header information of the received HTTP response data contains a status code other than 2XX, another statistic named "Non-2xx responses" is displayed in the test results to count the number of requests that are not counted in the failed request.
Total transferred represents the sum of the response data lengths for all requests, including the header information for each HTTP response data and the length of the body data. Note that this does not include the length of the HTTP request data, only the total length of the application layer data that the Web server flows to the user's PC.
The HTML transferred represents the sum of the body data in all the requested response data, minus the length of the header information in the HTTP response data in total transferred.
Requests per second throughput rate, calculation formula: Complete Requests/time taken for tests
Time per request user average request latency, calculation formula: Times token for tests/(complete requests/concurrency level)
Time per Requet (across all concurrent requests) The average request latency of the server, calculated by the formula: Timing taken for tests/complete requests, exactly the reciprocal of the throughput rate. You can also count: Time per request/concurrency level
Transfer rate represents the length of data that these requests get from the server within a unit time, calculating the formula: Total Trnasferred/time taken for tests, this statistic is a good indication of the capacity of the server to reach the limit of its export broadband demand.
Percentage of requests served within a certain time (MS) This data is used to describe the distribution of each request processing times, such as the above test, 80% of the request processing time is not more than 6ms, This processing time refers to the previous time per request, that is, for a single user, the average processing times for each of the requests.
Apache AB tool for stress testing