File description
ab is a useful stress test tool that comes with apache. When Apache is installed, ab can be found under bin
Download Link
Linux/Mac: 1,yum -y install httpd-tools View information: ab-V 2,http://httpd.apache.org/download.cgi#apache24 Windows: http://www.apachehaus.com/cgi-bin/download.plx Unzip after downloading and append PATH environment variables such as "; E:\software\Apache24\bin"
test case
#We can simulate 100 concurrent users and send 100 requests to a page# ab -n 100 -c 100 -p E:\param.txt -T application/json http://xx.com Common parameters -n Number of requests -c concurrency number -p parameter text path -T Request Parameter Type More parameters -n Number of requests executed in the test session.By default, only one request is executed. -c Number of requests generated at one time.The default is one at a time. -t The maximum number of seconds the test takes.Its internal implicit value is -n 50000, which limits testing on the server to a fixed total time.By default, there is no time limit. -p contains files that require POST data. -P Provides BASIC authentication trust to a transit agent.User names and passwords are separated by one: and sent in base64 encoding.This string is sent regardless of whether the server needs it (that is, if a 401 certification requirement code is sent). Content-type header information used by -T POST data. The -v setting shows how detailed the information is - 4 or more values show header information, 3 or more values show response codes (404,200, etc.), and 2 or more values show warnings and other information. -V Displays the version number and exits. -w Outputs the results in an HTML table format.By default, it is a table of two column widths on a white background. -i Execute HEAD requests, not GET s. -x Sets the string of the <table>property. -X uses a proxy server for requests. -y Sets the string of the <tr>property. -z sets the string for the <td>property. -C appends a Cookie: line to the request.Typically, this is a parameter pair of name=value, which can be repeated. -H appends additional header information to the request.Typically, this parameter is a valid header information line that contains colon-separated pairs of fields and values (for example, "Accept-Encoding:zip/zop;8bit"). -A Provides BASIC authentication trust to the server.User names and passwords are separated by one: and sent in base64 encoding.This string is sent regardless of whether the server needs it (that is, if a 401 certification requirement code is sent). -h Displays how to use it. -d does not display the message "percentage served within XX [ms] table" (support for previous versions). -e produces a comma-separated (CSV) file that contains the corresponding percentage of time (in subtle units) needed to process requests for each corresponding percentage (from 1% to 100%).This format is more useful than the'gnuplot'format because it is already'binary'. -g Writes all test results to a'gnuplot'or TSV (Tab delimited) file.This file can be easily imported into Gnuplot,IDL,Mathematica,Igor or even Excel.The title of the first behavior. -i Execute HEAD requests, not GET s. -k enables the HTTP KeepAlive function, which executes multiple requests in an HTTP session.KeepAlive is not enabled by default. -q If the number of requests processed is greater than 150, ab outputs a progress count at stderr for every 10% or 100 requests processed.This-q tag suppresses this information.
Return Information Resolution
This is ApacheBench, Version 2.3 <$Revision: 1796539 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to 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 Completed 1000 requests Finished 1000 requests Server Software: Apache-Coyote/1.1 ##apache version Server Hostname: 127.0.0.1 ##Requested Machine Server Port: 8080 ##Request Port Document Path: / Document Length: 1825 bytes ##Page Length Concurrency Level: 100 ##Concurrency Number Time taken for tests: 0.273 seconds ##How much time was used in total Complete requests: 1000 ##Number of requests Failed requests: 0 ##Failed Request Total transferred: 275000 bytes ##Total number of bytes transferred, including http header information, etc. HTML transferred: 25000 bytes ##html bytes, actual page delivery bytes Requests per second: 3661.60 [#/sec] (mean) ##The number of requests per second, which is a very important parameter value, is the throughput of the server Time per request: 27.310 [ms] (mean) ##Average Request Wait Time for Users Time per request: 0.273 [ms] (mean, across all concurrent requests) #Average server processing time Transfer rate: 983.34 [Kbytes/sec] received ##Length of data fetched per second Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 2.3 0 16 Processing: 6 25 3.2 25 32 Waiting: 5 24 3.2 25 32 Total: 6 25 4.0 25 48 Percentage of the requests served within a certain time (ms) 50% 25 ## 50% of requests returned within 25 ms 66% 26 ## 60% of requests returned within 26 MS 75% 26 80% 26 90% 27 95% 31 98% 38 99% 43 100% 48 (longest request)