AB is an HTTP stress testing tool that comes with Apache.ApacheBenchIt is easier to use than Microsoft's wast, HP's LoadRunner, and qaload.
AB is an installation component of Apache. Therefore, you must download and install Apache before using it. This command is located in the bin folder under the Apache installation directory.
AB is a benchmark testing dedicated for HTTP server. It can simulate multiple concurrent requests at the same time.
AB is designed to describe the execution performance of the currently installed Apache, mainly to show how many requests can be processed per second by the installed Apache.
AB is not as powerful as LR, but it is light enough. If you want to check the response of a module during development, or do some simple tests in some scenarios, AB is a good choice.
At least you don't have to spend a lot of time learning the complicated features in LR, let alone the license price.
The following describes how to use it.
Query version: [AB-v] (note that the value is in upper case)
[Jadyer@Jadyer-RHEL63 ~]$ ab -VThis 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/
Query parameters: [AB-v] (note that the values are lower-case values)
[Jadyer @ Jadyer-RHEL63 ~] $ AB-VAB: option requires an argument -- VAB: Wrong Number of argumentsusage: AB [Options] [http [s]: //] hostname [: Port]/pathoptions are: // test the number of requests executed in the session. By default, only one request is executed-N requests number of requests to perform // The number of requests generated at a time, that is, the number of requests sent at a time, the default value is the maximum number of seconds for a-c concurrency number of multiple requests to make // test. The default value is no time limit .... the internal implicit value is [-N 50000], which can limit the server test to a fixed total time-T timelimit seconds to Max. wait for responses-B windowsize size of TCP send/Receive Buffer, in bytes // file containing the data to post-P postfile file containing data to post. remember also to set-t-u putfile file containing data to put. remember also to set-T // Content-Type Header used by post data-T Content-Type Header for posting, eg. 'application/X-WWW-form-urlencoded 'default is 'text/plain '// set the details of the displayed information. If the value is 4 or greater, the header information is displayed, 3. A response code (404,200, etc.) can be displayed for a greater value ), 2 or a greater value can display warnings and other information-V verbosity how much troubleshooting info to print // output the results in the form of an HTML table, by default, a table with two columns of width in the white background-W print out results in HTML tables // executes the head request, instead of the get-I use head instead of get // string that sets the <Table> attribute, this attribute is filled in with <Table here>-x attributes string to insert as table attributes // set the string of the <tr> Attribute-y attributes string to insert As tr attributes // set <TD> attribute string-Z attributes string to insert as TD or th attributes // append a cookie row to the request, the typical form is the name = value parameter pair, which can be repeated-C attribute add cookie, eg. 'apache' = 1234. (repeatable) // append additional header information to the request. This parameter is typically a valid header information line, it contains pairs of fields and values separated by colons (for example, "Accept-encoding: Zip/zop; 8bit")-H attribute add arbitrary header line, eg. 'Accept-encoding: gzip' inserted after all normal header lines. (repeatable) // HTTP verification, separated by a colon (:) to pass the user name and password-A attribute add basic WWW authentication, the attributes are a colon separated username and password. // provides basic authentication trust for a transit proxy. the user name and password are separated by a colon, and the string is sent in base64 encoding format // no matter whether the server needs it (that is, whether or not the 401 authentication request code is sent), this string will be sent-P attribute add basic proxy authentication, the attributes are a colon separated username and password. // use the proxy server-x proxy: Port proxyserver and port number to use for the request // display the version number and exit-V print version number and exit // enable the HTTP keepalive function, that is, multiple requests are executed in an HTTP session, the keepalive feature is disabled by default-K use HTTP keepalive feature // messages that do not display "percentage served within XX [MS] Table" (supported for previous versions) -d do not show percentiles served table. // if the mean value and the mean value are between one and two times the standard deviation value, no warning or error information is displayed, by default, the minimum, average, and maximum values are displayed (supported by previous versions)-S do not show confidence estimators and warnings. // write all test results to a 'gnupload' or TSV (separated by tabs) file // This file can be easily imported to gnuplot, IDL, Mathematica, Igor or even excel, the first behavior title-G filename output collected data to gnuplot format file. // generate a comma-separated (CSV) file that contains the corresponding percentage (in subtle units) required to process each request with a corresponding percentage (from 1% to 100%) time // because this format has been "binary", it is more useful than the 'gnuplot' format-e filename output CSV file with percentages served-r don't exit on socket receive errors. // display usage-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)
Test Website: [AB-N 1000-C 10 http: // 192.168.8.35: 9000/nocardnopasswordsign]
-N indicates the total number of requests sent
-C indicates the number of concurrent requests each time.
The maximum number of concurrent connections supported by AB is unlimited, but the actual value depends on the maximum number of files allowed to be opened by each process in Linux, that is, [ulimit-N].
[Jadyer @ Jadyer-RHEL63 ~] $ AB-N 1000-C 10 https://epay.10010.com/This is apacheloud, 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 supplied (Be patient) completed 100 requestscompleted 200 requestscompleted 300 completed 400 completed 500 completed 600 requestscompleted 700 requestscompleted 800 requestscompleted 900 requestscompleted 1000 requests // name of the tested web service software, it comes from the header information of the HTTP Response Data (APACHE-Coyote/1.1, that is, Tomcat) server software: APACHE-Coyote/1.1 // server host name, server Hostname: epay.10010.com//monitored port server port: 443ssl/TLS Protocol: tlsv1/SSLv3, DHE-RSA-AES256-SHA, 2048,256 // path of the request URL, that is, the length of the requested resource document path: // HTTP response body, excluding the response header, that is, the length of the header information in the total transferred HTML response data minus the document length: 0 bytes // Number of concurrencies (set by the-C attribute) concurrency level: 10 // The time taken to execute all the requests, that is, the duration of the entire test. time taken for tests: 26.121 seconds // number of completed requests complete requests: 1000 // number of failed requests: 0 write errors: 0non-2xx responses: 1001 // number of network transmissions throughout the scenario, that is, the total response data of all requests, including header information and body length total transferred: 299299 bytes // The amount of HTML content transmitted throughout the scenario, that is, the body length of the response data in all requests, length of the header information not included: HTML transferred: 0 bytes // throughput: the number of requests processed per second, which is equivalent to the number of transactions per second in LR. The mean in the brackets indicates that this is an average value, the value is complete requests/time taken for testsrequests per second: 38.28 [#/sec] (mean) // average request wait time: equivalent to the average transaction response time in LR, the value is time taken for tests/(complete requests/concurrency level) time per request: 261.206 [MS] (mean) // time when the server average request is processed, that is, the average of the actual running time of each request, with a value of time per request/concurrency leveltime per request: 26.121 [MS] (mean, average SS all concurrent requests) // average network traffic per second, that is, the length of the Data these requests obtain from the server within the unit. The value is (total transferred/time taken for tests /) 1024 // This statistical option can indicate the demand for outgoing bandwidth of the server when the processing capability reaches the limit. // It can help eliminate the problem of excessive network traffic and prolonged response time. Transfer Rate: 11.19 [Kbytes/sec] partitioned ed // decomposition of the time consumed on the network, the specific algorithm of each data is not very clear connection times (MS) min mean [+/-SD] median maxconnect: 85 222 101.0 205 1224 processing: 12 38 23.4 34 151 waiting: 12 37 23.5 33 151 Total: 144 259 100.9 244 1268 // the response of all requests in the entire scenario. Each request has a response time in the scenario. // The following results show that, 50% of the user response time (that is, the request processing time. The processing time here refers to the time per request) is less than 244 milliseconds. // 66% of the user response time is less than 252 milliseconds, the maximum response time is less than 1268 Ms // for concurrent requests, the CPU does not actually process at the same time, it is rotated one by one based on the time slice obtained by each request. // Therefore, the first time per request time is basically equal to the second time per request time multiplied by the number of concurrent requests percentage of the requests served within certain time (MS) 50% 244 66% 252 75% 254 80% 255 90% 260 95% 481 98% 665 99% 686 100% 1268 (longest request)
Obtain website information
[Jadyer@Jadyer-RHEL63 ~]$ curl -Is https://epay.10010.com/HTTP/1.1 302 Moved TemporarilyDate: Tue, 06 Nov 2012 17:52:13 GMTServer: Apache-Coyote/1.1Location: http://epay.10010.com/404.jspContent-Type: text/vnd.wap.wml;chartset=gbk;charset=GBKSet-Cookie: JSESSIONID=9DDBCA78C7FEF4ABECD070E744CE926C; Path=/