AB pressure test

Source: Internet
Author: User

Apache comes with AB, which is very easy to use and AB can initiate test requests locally directly on the Web server. This is critical because we want to test the processing time of the server without including the data on the network transmission time and the user PC's local computing time.

It is clear that the essence of AB's testing is HTTP-based, so it can be said that it is a black-box performance test for Web server software, and that all the data and calculations it obtains can be explained by HTTP.

Other stress testing software, including Loadrnner, JMeter, etc., is to varying degrees include the server processing time outside, such as LoadRunner run on the user's PC, can record browser behavior, the results of this test play a focus on the site user's perspective, There are other levels of reference meaning.

Next, we will use AB for a stress test, in this book we use AB, which is included with Apache 2.3, whose version information is as follows:

[Email protected] ~]#/usr/local/apache/bin/ab-vthis is apachebench,version2.3< $Revision: 655654 $> Copyright1996adamtwiss,zeustechnologyltd, http://www.zeustech.net/Licensed to theapachesoftwarefoundation,/HTTP www.apache.org/

Take a look at the following command-line information:

[[email protected] ~]# /usr/local/apache/bin/ab -n1000 -c10 http://localhost/ index.htmlthis is apachebench,version2.3< $Revision: 655654 $>copyright1996adamtwiss, zeustechnologyltd, http://www.zeustech.net/licensed to theapachesoftwarefoundation, http:/ /www.apache.org/benchmarking localhost  (be patient) completed100 requestscompleted200  requestscompleted300 requestscompleted400 requestscompleted500 requestscompleted600  requestscompleted700 requestscompleted800 requestscompleted900 requestscompleted1000  requestsfinished1000 requests serversoftware:apache/2.2.19serverhostname:         localhostServerPort:80DocumentPath:/index.htmlDocumentLength:45 bytes  Concurrencylevel:10time taken for tests:0.454 secondscomplete requests:1000failed  requests:0write errors:0total transferred:322644 byteshtml transferred:45090 bytesrequests per second:2204.64[#/ sec]  (mean) time per request:4.536[ms] (mean) time per request:0.454[ms] (mean,  across all concurrent requests) transfer rate:694.64[kbytes/sec] received  Connectiontimes (MS)               min   mean[+/-sd] median   maxconnect:010.515processing:135.6262waiting:0 35.6262total:145.6363percentage of the requests served within a certain  time  (ms) 50%366%475%480%490%695%1298%2699%33100%63 (longest request)

Note that when we start AB, we pass in 3 command-line arguments, which represent the prerequisites mentioned earlier:
-n1000 indicates total request digit 1000
-c indicates that the number of concurrent users is 10
http://localhost/index.html represents the destination URL for these requests.
The test results are at a glance, and we see that the throughput rate is shown as 2204.64reqs/s. At the same time, there are some other content in the test results also worthy of our attention, mainly including:
server software
vi/usr/local/apache/conf/httpd.conf #隐藏具体版本信息
serversignature off
ServerTokens Prod

Server Hostname
Represents the host part name in the requested URL, which comes from the header information of the HTTP request data, where the URL we requested is http://localhost/index.html, so the hostname is localhost, stating that our request was initiated from the Web server side.

Server Port
Indicates the listening port of the Web server software being tested, we will use different listening ports for several different Web server software for the convenience of testing.

Document Path
Represents the root absolute path in the requested URL, and it also comes from the header information of the HTTP request data, and through its suffix, we can generally understand the type of the request.

Document Length
Represents the body length of the HTTP response data.

Concurrency level
Represents the number of concurrent users, which is the parameter we set.

Time taken for tests
Represents the total time spent by all these requests being processed. By the way, some Apache versions, such as the AB included with 2.2.4, have some computational bugs for this statistic, and when the total number of requests is small, the total time of the statistics will not be less than 0.1s.

Complete requests
Represents the total number of requests, which is the corresponding parameter we set.

Failed Requests
Indicates the number of failed requests, where the failure is the request to connect to the server, send data, receive data, such as an exception, and no response after the situation of timeout. The setting for the time-out can be used with the-t parameter of AB.
If the header of the received HTTP response data contains a status code other than 2xx, the test results will show another statistic named "Non-2xx Responses", which is used to count the number of requests, which are not considered failed requests.

Total transferred
Represents the sum of the response data length 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, so total
Transferred represents the total length of the application layer data flowing from the Web server to the user's PC. You can view detailed HTTP header information by using the-v parameter of AB.

HTML Transferred
Represents the sum of the body data in the response data for all requests, minus the length of the header information in the HTTP response data in total transferred.

Requests per second
This is the throughput rate that we focus on, which equals:
Complete Requests/time taken for tests

Time per request
This is the average user request wait time mentioned earlier, which equals:
Time taken for tests/(complete requests/concurrency level)

Time per request? (across all concurrent requests)
This is the previously mentioned server average request processing time, which equals:
Time taken for Tests/complete requests

This is the inverse of the throughput rate. At the same time, it also equals:
Time per request/concurrency level

Transfer Rate
Represents the length of data that these requests get from the server within a unit time, which equals:
Total Transferred/time taken for tests
This statistic can be a good indication of the demand of the server's export bandwidth when the processing capacity reaches the limit.
Using the knowledge of the bandwidth described earlier, it is not difficult to calculate the results.

Percentage of the requests served within a certain time (MS)
This part of the data is used to describe the distribution of each request processing time, such as in the above test results, 80% request processing time is not more than 1ms, and 99% of the request is not more than 2ms. Note that the processing time here is the previous time per request, that is, for a single user, the average duration of the processing of the requests.

Continue the stress test
Next, let's do a stress test, where the number of concurrent users is 100, the other conditions are the same, and the test results are as follows:

[[email protected] ~]# /usr/local/apache/bin/ab -n1000 -c100 http://localhost/ index.htmlthis is apachebench,version2.3< $Revision: 655654 $>copyright1996adamtwiss, zeustechnologyltd, http://www.zeustech.net/licensed to theapachesoftwarefoundation, http:/ /www.apache.org/benchmarking localhost  (be patient) completed100 requestscompleted200  requestscompleted300 requestscompleted400 requestscompleted500 requestscompleted600  requestscompleted700 requestscompleted800 requestscompleted900 requestscompleted1000  requestsfinished1000 requests serversoftware:apache/2.2.19serverhostname:         localhostServerPort:80DocumentPath:/index.htmlDocumentLength:45 bytes  Concurrencylevel:100time taken for tests:0.369 secondscomplete requests:1000failed  requests:0write errors:0total transferred:283648 byteshtml transferred:46080 bytesrequests per second:2711.45[ #/sec]  (mean) time per request:36.881[ms] (mean) time per request:0.369[ms] (mean,  across all concurrent requests) transfer rate:751.07[kbytes/sec] received  Connectiontimes (MS)               min   mean[+/-sd] median   maxconnect:0123.41219processing:112318.917122waiting :61918.313114total:203517.130128percentage of the requests served within a  certain time  (ms) 50%3066%3275%3480%3590%5395%7598%9999%114100%128 (longest request)

Compared with the previous test results, it can be seen that when the concurrent user data from the original 10 to 100, the throughput rate from the original 2204.64 to 2711.45, the server average request processing
The time from the original 0.454ms to 0.369ms, and the user evaluation request waiting time from the original 4.536ms increased to 36.881ms.
As the number of concurrent users changes, the throughput rate, the average request waiting time of the user, and the processing time of server accessory request have changed correspondingly.


This article is from the "ZPP" blog, make sure to keep this source http://1439337369.blog.51cto.com/10270624/1787985

AB pressure test

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.