ab website stress test command parameters, Chinese annotations of the output results
permalink
After installing APACHE before, I always didn’t know how to test the performance of APACHE. Now I finally found a testing tool. It is the testing tool AB (apache benchmark) that comes with APACHE. It is in the bin directory of APACHE.
Format: ./ab [options] [http://]hostname[:port]/path
Parameters:
-n requests Number of requests to perform
//In the test session The number of requests executed. By default, only one request is executed
-c concurrency Number of multiple requests to make
//The number of requests generated at one time. The default is one at a time.
-t timelimit Seconds to max. wait for responses
//The maximum number of seconds for the test. Its internal implicit value is -n 50000. It can limit the testing of the server to a fixed total time. By default, there is no time limit.
-p postfile File containing data to POST
//A file containing data that requires POST.
-T content-type Content-type header for POSTing
//Content used for POST data -type header information.
-v verbosity How much troubleshooting info to print
//Set the verbosity of the displayed information - 4 or greater will display header information, 3 or greater will display response codes (404, 200, etc.), A value of 2 or greater can display warnings and other information. -V Display version number and exit.
-w Print out results in HTML tables
//Output the results in HTML table format. By default, it is a two-column width table with a white background.
-i Use HEAD instead of GET
// Perform HEAD request 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)
//-C cookie-name=value Attach a Cookie to the request: line. Its typical form is a parameter pair of name=value. This parameter can be repeated.
-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.
//-P proxy-auth-username:password Provided for a transit proxy BASIC certified trust. The username and password are separated by a : and sent in base64 encoding. This string is sent regardless of whether the server requires it (i.e., whether a 401 authentication requirement code was sent).
-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
-h Display usage information (this message)
/ /-attributes String to set attributes. There are various statically declared fixed-length buffers in the defective program. Additionally, the parsing of command line arguments, server response headers, and other external input is trivial, which can have undesirable consequences. It is not a complete implementation of HTTP/1.x; it only accepts certain 'expected' response formats. Frequent use of strstr(3) may cause performance issues, i.e., you may be testing ab rather than the performance of the server.
There are many parameters, generally we just use -c and -n parameters. For example:
./ab -c 1000 -n 1000 http://127.0.0.1/index.php
This means processing 1000 requests at the same time and running the index.php file 1000 times.
#/usr/local/xiaobai/apache2054/bin/ab -c 1000 -n 1000 http://127.0.0.1/index .html.zh-cn.gb2312
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests
Server Software: Apache/2.0.54
//Platform apache version 2.0.54
Server Hostname: 127.0.0.1
//Server host name
Server Port: 80
//Server port
Document Path: /index.html.zh-cn.gb2312
//Tested page document
Document Length: 1018 bytes
//Document size
Concurrency Level: 1000
//Number of concurrency
Time taken for tests: 8.188731 seconds
//The duration of the entire test
Complete requests: 1000
//The number of completed requests
Failed requests: 0
//Number of failed requests
Write errors: 0
Total transferred: 1361581 bytes
//Network transfer volume in the entire scene
HTML transferred: 1055666 bytes
//HTML content transfer volume in the entire scene
Requests per second: 122.12 [ #/sec] (mean)
//One of the indicators that everyone is most concerned about is equivalent to the number of transactions per second in LR. The mean in brackets indicates that this is an average value
Time per request: 8188.731 [ ms] (mean)
//The second indicator that everyone is most concerned about is equivalent to the average transaction response time in LR. The mean in the following brackets indicates that this is an average value
Time per request: 8.189 [ms] (mean, across all concurrent requests)
//The average of the actual running time of each request
Transfer rate: 162.30 [Kbytes/sec] received
//The average traffic on the network per second, can help Troubleshoot whether there is a problem that excessive network traffic causes prolonged response time
Connection Times (MS)
MIN Mean [ /-SD] Median Max
Connect: 4 646 1078.7 89 3291
PROCESSING: 1692 493.1 938 4712
118 934 480.6 8 82 4554
Total: 813 1638 1338.9 1093 7785
//The breakdown of time spent on the network, the specific algorithm of each data is not very clear yet
Percentage of the requests served within a certain time (ms)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (longest request)
//The response status of all requests in the entire scenario. In the scenario, each request has a response time, 50% of the user response time is less than 1093 milliseconds, 60% of the user response time is less than 1247 milliseconds, and the maximum response time is less than 7785 milliseconds
Since for concurrent requests, the CPU does not actually process them at the same time, but rotates them one by one according to the time slice obtained by each request, so basically the first Time per request time is approximately equal to the second Time per request Time multiplied by number of concurrent requests
Recommended: http://www.cnblogs.com/roucheng/p/texiao.html