Apache AB Test usage Guide

Source: Internet
Author: User
Tags connection reset nginx server server port cipher suite

Introduction: AB Test is the industry's more popular and easy-to-use pressure test kit, this article will briefly describe its core use of the method.

1. AB

AB is an acronym for Apache HTTP Server Benchmarking tool that can be used to test server performance for HTTP requests. It is a combination of simple and easy-to-use Performance test tool commands with different parameters from the command line.

2. Environmental information

CentOS 7, AB's version is 2.3, and the current version is 2.4.


3. Guidelines for use

3.1 View the contents of the Help file

[root@test~]# ab-h Usage:ab [Options] [http[s]://]hostname[:p ort]/path options are:-N requests number of Reques TS to perform-c concurrency number ' multiple requests to ' at a time-t timelimit to Max. To spend on benchmarking this implies-n 50000-s timeout to max. Wait for each response the Default is Seconds-b windowsize Size of TCP send/receive buffer, in B Ytes-b address to bind to at making outgoing connections-p postfile File containing data to P Ost. 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 troubleshooti ng info to print-w print out results in HTML tables-istead of Get-x attributes string to insert as table attributes-y attributes String to insert as TR attribute S-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 the all normal header lines. (repeatable)-a attribute Add Basic WWW authentication, the attributes are a colon separated us
    Ername and password. -P attribute Add Basic Proxy authentication, the attributes are a colon separated username and pass
    Word. -X Proxy:port ProxyServer and port number to Use-v Print version number and exit-k U
    Se HTTP KeepAlive feature-d does not show percentiles served table.
    -S don't show confidence estimators and warnings. -Q Don't show progress when doing more than 150 requests-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. -H Display Usage information (this message)-Z ciphersuite specify SSL/TLS cipher Suite (* * OpenSSL CIP Hers)-F Protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, TLS1.1, TLS1.2 or All)
3.2 Preliminary test

Parameter Description:-N Request Quantity,-C concurrent Quantity

AB option url-address

Case 1:AB-N1000-C10 http://www.baidu.com/index.html

The resulting information is as follows:

[Root@flybird ~]# ab-n1000-c10 http://www.baidu.com/index.html This
is Apachebench, Version 2.3 < $Revision: 1430  $>
Copyright 1996 Adam Twiss, Zeus Technology LTD, http://www.zeustech.net/licensed to the
Apache Software Foundation, http://www.apache.org/

Benchmarking www.baidu.com (Be patient) Completed
Completed requests Completed Completed requests Completed
requests requests
Requests
Completed requests Completed-
requests Completed 900 requests APR_SOCKET_RECV
: Connection Reset by Peer (104)
Analysis Baidu does not allow direct such testing, directly to the request reset.

Case 2:

   Command:  ab-n1000-c10 http://www.csdn.net/index.html
Test results:
[root@test~]# ab-n1000-c10 http://www.csdn.net/index.html This is apachebench, Version 2.3 < $Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to the Apache Software Foundation, http: Www.apache.org/Benchmarking www.csdn.net (Be patient) Completed requests Completed MB requests Completed ESTs Completed requests Completed requests Completed requests Completed requests Completed Co
Mpleted 900 Requests Completed 1000 requests finished 1000//server information: Requests Servers Openresty        Server Hostname:www.csdn.net Server port:80 document Path:/index.html document Length: 100686 bytes Concurrency level:10 time taken for tests:24.567 seconds Complete requests:1000 Failed req
uests:0 Write errors:0 Total transferred:100982000 bytes HTML transferred:100686000 bytes The throughput of the server, the amount of request processing per second requesTS per second:40.71 [#/sec] (mean)//user Average latency time/request:245.665 [MS] (mean)//server-side processing time of a single request/req uest:24.567 [MS] (mean, across all concurrent requests) Transfer rate:4014.21 [Kbytes/sec] received Conn Ection times (ms) min MEAN[+/-SD] Median max connect:38 175.3-3065 4 173 30.4 170 446 waiting:38 9.6 302 total:152 244 180.7 213 3294 Perce
  Ntage of the requests served within a certain time (ms) 50% 213 66% 238 75% 247 80% 249 90% 256 98% 1201 99% 1248 100% 3294 (longest request)
Test Result: Request throughput is: 40.71/S, single request processing time is: 24.567

Case 2:AB-N1000-C10 http://www.sina.com.cn/index.html

[root@test~]# ab-n1000-c10 http://www.sina.com.cn/index.html This is apachebench, Version 2.3 < $Revision: 1430300 $&G
T Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to the Apache Software Foundation, http: Www.apache.org/Benchmarking www.sina.com.cn (Be patient) Completed requests Completed/Requests Completed 
Equests Completed Requests Completed requests Completed requests Completed m requests Completed  Completed 900 Requests Completed 1000 requests finished 1000//background server is requests Server Nginx server        Hostname:www.sina.com.cn Server port:80 Document Path:/index.html document Length: 27201 bytes Concurrency level:10 time taken for tests:8.470 seconds Complete requests:1000 Failed requests : 0 Write errors:0 total transferred:27538766 bytes HTML transferred:27201000 bytes Request S per second:118.[#/sec] (mean) time/request:84.704 [MS] (mean) time/request:8.470 [MS] (mean, across all Concurre NT requests) Transfer rate:3174.97 [kbytes/sec] received Connection times (ms) min MEAN[+/-SD] m   Edian Max connect:15 70.7 1026 processing:32-24.3-321 WAITING:15 24  16.4 253 total:47 74.9 1094 Percentage of the requests a served within a certain time  (MS) 50% 74 66% 84 75% 90 80% 92 90% 103 95% 120 98% 124 99% 289 100% 1094 (Longest request)
Analysis results: Request throughput is: 118.06/S, the time the server processes a single request is 8.470 Ms. Compared with csdn.net, Shu Qi is nearly 3 times times more efficient. The CSDN is 40 requests/s, and a single request is 24ms.

That question why Sina is 3 times times higher than Csdn's performance. Let us briefly analyze, first is the amount of data transmitted, CSDN is 3 times times the Sina, the following are based on mean time.

Site Connect Processing Waiting Total
Csdn 71 173 46 244
sina.com.cn 27ms 57 24 84
On the whole, it can be found that sina.com.cn is due to csdn performance on each node.

3.3 Increase the number of concurrent pressure measurement (single machine)

Case 1:ab-c100-n1000 http://www.csdn.net/index.html [100 Concurrent number]

HTML transferred:       100580778 bytes
Requests/second:    52.39 [#/sec] (mean) time per
request:       1908.606 [MS] (mean) time/
Request:       19.086 [MS] (mean, across all concurrent requests)
Transfer rate:          5161.49 [Kbytes/sec] Received
Compared with previous data, the throughput rose from 40 to 52 after concurrency was set to 100, and a single request response time was reduced from 24ms to 19ms

Case 2:ab-c200-n1000 http://www.csdn.net/index.html

HTML transferred:       100358484 bytes
Requests/second:    48.32 [#/sec] (mean) time per
request:       4139.429 [MS] (mean) time/
Request:       20.697 [MS] (mean, across all concurrent requests)
Transfer rate:
  4749.23 [Kbytes/sec] Received
Compared with previous data, the concurrency number is 200, the throughput is decreased, and the response time becomes longer.

Case 3:ab-c500-n1000 http://www.csdn.net/index.html [100 Concurrent number]

HTML transferred:       83827148 bytes
Requests/second:    49.05 [#/sec] (mean) time per
request:       10193.544 [MS] (mean) time/
Request:       20.387 [MS] (mean, across all concurrent requests)
Transfer rate:
  
   4029.59 [Kbytes/sec] Received

  
Results analysis: The overall data does not change much, but for individual users, the waiting time becomes longer and requires 10s.

6. Reference http://httpd.apache.org/docs/current/programs/ab.html

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.