Introduction to Apache Benchmark (AB) tools and production drawings with gnuplot

Source: Internet
Author: User
Tags benchmark cipher suite

Brief introduction:

Apache Beach (AB) is a performance testing tool from Apache that is designed to test the performance of your Web site, not just the Apache Web server.

It can simulate multiple concurrent requests at the same time, test the maximum load-carrying pressure of the Web server, and can also adjust the server performance parameters according to the test results provided by Apache bench. It can record test data, and other tools such as gnuplot can be analyzed using test data. It can also provide a summary that visually shows the performance of the Web server currently being tested.

How to use:

Usage:ab [Options] [http[s]://]hostname[:p Ort]/path
Options are:
- N Requests number of requests to perform
- c concurrency number of multiple requests to make at a time
-T TimeLimit Seconds to Max. To spend on benchmarking
This implies-n 50000
-S timeout Seconds to Max. Wait for each response
Default is seconds
-B windowsize Size of TCP send/receive buffer, in bytes
-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 for post/put data, eg.
' Application/x-www-form-urlencoded '
Default is ' Text/plain '
-V verbosity how much troubleshooting info to print
-W Print out results in HTML tables
-I use HEAD 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)
-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
is a colon separated username and password.
-P attribute Add Basic Proxy authentication, the attributes
is 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 more than requests
-L Accept Variable document length (use this for dynamic pages)
-G filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-R Don ' t exit on socket receive errors.
-M Method name
-H Display Usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (see OpenSSL ciphers)
-F Protocol Specify SSL/TLS protocol
(SSL3, TLS1, TLS1.1, TLS1.2 or All)

The use of AB can be queried by ab-h.

It should be noted that:

1. The-l option can be used when AB handles dynamic pages such as PHP without ducument length as a criterion for failed requests. See the Command output section for details.

2. The-G option can be used to output a gnuplot format file that can then be used to draw an image using Gnuplot. See the Drawing section for details.

Command output:

Command: Ab-n 2000-c http://www.testnginx.com/lottery/user.php\?token\=b0c21347eccacde3179412115fd5765f\&ac_id\= 2\&action\=lotter

Output:

This is apachebench, Version 2.3 < $Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/

Benchmarking www.testnginx.com (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed 1400 requests
Completed requests
Completed 1800 requests
Completed requests
Finished requests


Server software:nginx/1.10.2// Server Software represents the Web server software name being tested
Server Hostname:www.testnginx.com// Server Hostname represents the requested URL host name
Server port:80// Server port indicates the listening port of the Web server software being tested




Document Path:/lottery/user.php?token=b0c21347eccacde3179412115fd5765f&ac_id=2&action=lottery //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:35 bytes // Document length indicates the body size of the HTTP response data
Concurrency level:10// Concurrency level represents the number of concurrent users, which is one of the parameters we set
Time taken for tests:2.983 seconds// time taken for tests indicates the total amount of times that all these requests have been processed to complete
Complete requests:2000// Complete requests represents the total number of requests, which is one of the parameters we set
Failed requests: 1899
(Connect:0, receive:0, length:1899, exceptions:0)
///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. 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:408548 Bytes// 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.
HTML transferred:82548 bytes // 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:670.58 [#/sec] (mean) // Requests per second throughput rate, calculation formula: Complete Requests/time taken for tests
Time per request:14.913 [MS] (mean)
// time per request user average request latency, calculation formula: Times token for tests/(complete requests/concurrency level)
Time per request:1.491 [MS] (mean, across all concurrent requests)        //time per Requet (across all concurrent requests) Server average request wait time, calculation formula: The hour taken for Tests/complete requests, exactly the reciprocal of the throughput rate. //You can also count: Time per request/concurrency level
Transfer rate:133.77 [Kbytes/sec] Received
// 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, which is a good statistic when the server's processing power reaches its limit. The demand for its export broadband.

Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 0 0.2 0 4
Processing:4 15 18.7 9 170
Waiting:4 15 18.7 9 170
Total:4 15 18.7 9 171
// The Connection Times (ms) represents the processing time of the connection during the stress test:
Horizontal axis section:
Min: Minimum value
Mean: mean value and positive and negative standard deviation
Median: Middle value
Max: Max value
Longitudinal axis section:
Connect:ab the time it takes to establish a connection to a web host from a TCP request
Processing: The time it takes to establish a successful start from a TCP connection to the full response (HTTP Response) of the HTTP Resquest request returned by the web host
Waiting: The time it takes to start an HTTP request to receive the first byte of the HTTP response returned by the web host
Total: The overall time that a request is consumed, that is, connect+ processing. Waiting included in the processing


Percentage of the requests served within a certain time (MS)
50% 9
66% 11
75% 14
80% 17
90% 26
95% 35
98% 93
99% 129
100% 171 (Longest request)
//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 17ms, 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.

In the AB output, there are two places to draw attention to:

1. Failed Request: There are 4 categories of failed requests: Connect, recieve, Length, Exceptions. Where length is the document length of the received response that is inconsistent with the value in document length, the request to obtain the response is processed as a failed request. (The document length given in the output should be the document length of the first successful response obtained). Obviously, for Dynamic Web pages Such processing is very unreasonable, AB provides the-l option, indicating that AB can accept variable document length.

2. We can add the-G option to the AB command so that AB outputs the statistics for each request in gnuplot format, with the following output:

StartTime seconds CTime dtime ttime wait
Sun May 28 13:20:37 2017 1495948837 0 4 5 4
Sun May 28 13:20:37 2017 1495948837 0 4 5 4
Sun May 28 13:20:38 2017 1495948838 0 4 5 4
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:38 2017 1495948838 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5
Sun May 28 13:20:37 2017 1495948837 0 5 5 5

which

StartTime: Human readable start time
Seconds: Unix timestamp value for start time
CTime: Connect in connection times (MS) in the corresponding AB output
Dtime: Processing in connection times (MS) in the corresponding AB output
Ttime: Total in connection times (MS) in the corresponding AB output
Wait: The waiting in the connection times (MS) in the corresponding AB output

With the gnuplot format file output through the-G option, we can use gnuplot to draw graphs about throughput rates, request response times, request connection times, and so on for more intuitive test analysis.

Drawing:

Introduction to the Apache Benchmark (AB) tool and introduction to using production drawings with gnuplot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.