Apache's AB test tool

Source: Internet
Author: User

AB command principle


Apache's AB commands simulate multi-threaded concurrent requests, test server load pressures, and test the pressure of Nginx, Lighthttp, IIS and other Web servers.

The AB tool that comes with Apache is very easy to use. The AB command is very low on the computer that emits the load, does not consume a lot of CPU, and does not take up too much memory, but it can cause huge load to the target server, so it is a necessary medicine for some DDoS attacks, which is suitable for all ages. You should use caution when using your own. Otherwise, too much load at a time, causing the target server directly due to memory loss of light, and have to hard restart, not worth the candle.

In the case of insufficient bandwidth, it is best to test this machine, it is recommended to use the intranet of another or more servers through the intranet to test, so that the data obtained, the accuracy will be much higher. Remote Web server stress testing, often ineffective (because the network latency is too large or insufficient bandwidth)


Installation Tools


Yum Install Httpd-tools


Usage


The display of usage information is actually ab-help.


-N is requests, which specifies the total number of executions for the stress test. -C is concurrency, which specifies the number of concurrency for a stress test. -T is timelimit, the maximum time (in seconds) to wait for a response. -B is the buffer size (in bytes) of the WINDOWSIZE,TCP Send/Receive. -P is postfile, the file to be uploaded when the POST request is sent, and the-T parameter must also be set. -U is putfile, the file that needs to be uploaded when the put request is sent, and the-T parameter must also be set. -T is Content-type, which sets the Content-type request header information, for example: application/x-www-form-urlencoded, the default value is Text/plain. -V is verbosity, which specifies the level of redundancy for printing help information. -W Prints the results in an HTML table format. -I uses 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" (You can repeat this parameter option to add multiple). -H Add any request header, for example: "Accept-encoding:gzip", the request header will be added after the existing multiple request headers (you can repeat the parameter option to add multiple). -a adds 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. -x Specifies the proxy server and port number used, for example: "126.10.10.3:88". -V Prints the version number and exits. -K uses the KeepAlive feature of HTTP. -D does not display percentages. -S does not display prediction and warning messages. -G outputs the result information to a file in the gnuplot format. -e Outputs The result information to a file in CSV format. -r Specifies that the program is not exited when an error message is received. -H


Test


While AB can be configured with more parameter options, in general we only need to use commands that are shaped like the Ab-n digital-c URL path. For example, we perform stress tests on http://192.168.0.10/. The total number of tests was 1000, and the number of concurrent sessions was 100 (equivalent to 100 users accessing them concurrently, with a total of 1000 visits). We enter the command:


Ab -n 1000 -c 100 http://192.168.0.10/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 192.168.0.10  (be patient) Completed 100  requestsCompleted 200 requestsCompleted 300 requestsCompleted 400  requestscompleted 500 requestscompleted 600 requestscompleted 700  requestscompleted 800 requestscompleted 900 requestscompleted 1000  requestsfinished 1000 requestsserver software:         nginx/1.12.2      (Server Software name and version information) server hostname:         192.168.0.10    &nBSP; (server hostname) server port:            80       (server port) document path:           /      (URL path for testing) document length:         612 bytes      (the document size returned by the URL for testing) concurrency level:       100      (concurrent number) time taken for tests:    0.528 seconds      (total time spent on stress test) complete requests:       1000      (total number of stress tests) failed requests:         0      (number of failed requests) write errors:            0      (number of network connection write errors) total transferred:       845000 bytes      (total amount of data transferred) html transferred:        612000 bytes      (total data volume of HTML documents) requests per second:     1894.30 [#/sec]  (mean)       (average number of requests per second) time per  request:       52.790 [ms]  (mean)       ( Average time for all concurrent users (here is 100) to request once) Time per request:       0.528 [ms]   (mean, across all concurrent requests)       (average time for a single user request) transfer rate:          1563.17 [kbytes/sec]  received      (transfer rate, Unit: KB/S) connection times  (ms)      (decomposition of time consumed on the network) min  mean[+/-sd] median   maxconnect:         7   21   9.7     20       53processing:     7   23   9.2      22      65Waiting:        7    22   8.8     21      63total :         16   45  11.6      42      75Percentage of the requests  served within a certain time  (MS) 50%     4266%      4775%     5080%     5490%      6495%     6898%     7099%      73           100%     75  (Longest request) 




Apache's AB test tool

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.