1. AB Introduction AB full name Apache Bench, is an Apache with a small tool, it can simultaneously simulate multiple concurrent requests, testing the maximum load pressure of Web servers such as Apache. Through a simple example, this paper introduces the performance test of Web pages using AB, the method of viewing results and the detailed operation parameters. The operating environment is a Windows 10 system. 2. AB Download Apache official website: http://httpd.apache.org/download.cgi2.1 Windows System for Windows systems, accessible pages https://www.apachelounge.com/ download/download the corresponding version of the ZIP package, we downloaded the version is: Httpd-2.4.29-win64-vc15.zip
You can also download the ab.exe that I extracted, unzip can use: https://files.cnblogs.com/files/lovesoo/ab.zip2.2 Linux system install Apache using the following command
Yum Install httpd
3. AB run using Cmd/shell into the Apache24\bin directory, run AB can be 4. The two most common running commands for performance testing using AB are as follows:
Ten http://www.cnblogs.com#-N Total 10 requests, -http:// www.cnblogs.com#-T is the test execution time,-C simulates 10 concurrent users, that is, 10 concurrent Requests Blog Park home page, lasting 10 seconds
5. Test results
6. Results Analysis
Server software:server Hostname:www.cnblogs.comServer Port: theDocument Path:/Document Length:147bytes #HTTP响应数据的正文长度Concurrency level:Ten#并发数Time taken forTests10.183seconds #测试执行时间Complete Requests:169#完成请求数Failed Requests:0#失败请求数Non-2XX Responses:169Total Transferred:65403bytes #网络总传输量HTML Transferred:24843bytes #HTML内容传输量Requests per second:16.60[#/sec] (mean) #每秒请求数Time per request:602.545[MS] (mean) #用户平均请求等待时间, calculation formula: Total time of test execution/(total requests/number of concurrent users) time per request:60.254[MS] (mean, across all concurrent requests) #服务器平均请求等待时间, calculation formula: Total time for test execution/total number of requests transfer rate:6.27[kbytes/sec] received #平均传输速率Connection times (ms) #响应时间小, medium, and large value min mean[+/-SD] Median Maxconnect:2 + 325.5 3 3006Processing: A 382 928.1 the 3072Waiting: A 376 922.1 - 3063Total: + 422 971.5 the 3075Percentage of the requests served within a certain Time(ms) #一定时间内请求完成的百分比, such as 50% users to complete the response time within 68MS, the% user completed the response time within 73MS, -%user completed within 3075MS -% the the% the the%Bayi the% - -%3060 the%3066 98%3069 About%3075 -%3075(Longest request)
7. The official help document of AB operating parameters is as follows:
Usage:ab [Options] [http://]hostname[:p Ort]/pathOptions are:-N Requests number of requests to perform-c concurrency number of multiple requests to MakeAt a Time-T TimeLimit Seconds to Max, spend on benchmarkingthis implies-N50000-S timeout Seconds to Max.wait forEach Responsedefault is -seconds-B windowsize Size of TCP send/receive buffer,inchbytes-B address to bind to when making outgoing connections-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 Content-type header to use forpost/PUT data, eg.'application/x-www-form-urlencoded'Default is'Text/plain'-V verbosity how much troubleshootingInfoTo print-WPrint out ResultsinchHTML Tables-I use HEAD instead of GET-x attributes String to insert as table attributes-Y attributes String to insert asTRattributes-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 Attributesare a colon separated username and password.-P attribute Add Basic Proxy authentication, the Attributesare 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.-Q Don't show progress when doing Morethan MaxRequests-l Accept Variable document length (Use this fordynamic pages)-G filename Output collected data to gnuplot formatfile.-e filename Output CSVfileWith percentages served-R Don'T exit on socket receive errors.-m Method name-H Display Usage information (this message)
Chinese translation is as follows:
-N is requests for specifying the pressure test/The total number of requests. -c is concurrency, which specifies the number of concurrency for a stress test. -T is timelimit, the test executes the maximum number of seconds, which allows the test to be limited to a fixed total time, the default value is 50000. -S is timeout, request maximum wait length, default 30s-B is windowsize,tcp send/buffer size (in bytes) received. -P is postfile, the file to be uploaded when sending the POST request, the file format as"p1=1&p2=2"。 The method of use is-p123txt WithT)-U is putfile, the file that needs to be uploaded when sending a put request. WithT)-T is content-type for setting Content-type request header information, such as-t"application/x-www-form-urlencoded ", the default value is Text/plain. (with-P)-V is verbosity, setting the verbosity of the display information –4 or a larger value displays the header information, 3 or greater can display the response code (404, 200, etc.), 2 or greater can display warnings and other information. -Wprints the results in an HTML table format. -I use a head request instead of a GET request. -x inserts a string as a property of the table label. -y inserts a string as a property of the TR label. -Z Inserts a string as a property of the TD label. -C Add cookie information, for example:"apache=1234". This parameter can be repeated, separated by commas. Tip: You can use the session implementation principle to pass Jsessionid parameters, to achieve the function of maintaining the session, such as-C"c1=1234,c2=2,c3=3, Jsessionid=ff056cd16da9d71cb131c1d56f0319f8". -H Add any of the request headers, for example:"Accept-encoding:gzip", the request header is added after the existing multiple request headers (you can repeat the parameter option to add multiple). -A add a basic network authentication information, separated by a colon between the user name and the password. -P Adds a basic proxy authentication message, separated by a colon between the user name and password. such as-P proxy-auth-Username:password-x Specifies the proxy server and port number used, for example:"126.10.10.3:88". -V Displays the version number and exits. -K uses the KeepAlive feature of HTTP. -d does not show percentages. -S does not display estimates and warning messages. -Q does not show progress after more than 150 requests-L Accept Variable document lengths (for dynamic pages)-g filename Outputs the result information to a file in the gnuplot format. -e filename Outputs The result information to a file in CSV format. -r Specifies that the program is not exited when an error message is received. -m Method name-H Help
AB Introductory article on Web performance testing tools