Apache uses the AB tool command to do performance testing tutorials

Source: Internet
Author: User
Tags auth base64 server port

We have our own servers, and sometimes we need to test how much data our servers can resist, which will help us deploy and configure our servers, and we have our own free performance testing tools in Apache, Ab (Apache bench) in the Apache bin directory, It can simulate multiple concurrent requests, meaning it is primarily used to test how many requests your Apache can handle per second.

Command syntax

AB [Options] [http://]hostname[:p Ort]/path
Parameter options

-A Auth-username:password

Provides basic authentication trust to the server. The username and password are separated by one: and sent in the form of a base64 encoding. This string is sent regardless of whether the server needs to (that is, whether the 401 authentication requirement code is sent).

-C concurrency

The number of requests produced at a time. The default is one at a time.

-C Cookie-name=value

Attach a cookie to the request: line. The typical form is a parameter pair of Name=value. This parameter can be repeated.

-D

The message "percentage served within XX [MS] table" is not displayed (support for previous versions).

-E Csv-file

Produces a comma-separated (CSV) file that contains the corresponding percentage (in subtle) time required to process each corresponding percentage request (from 1% to 100%). This format is more useful than the ' gnuplot ' format because it is "binary".

-G Gnuplot-file

Writes all test results to a ' gnuplot ' or TSV (tab-delimited) file. This file can be easily imported into gnuplot, IDL, Mathematica, Igor, and even Excel. One of the first behavioral headings.

-H

Displays the usage method.

-H Custom-header

Attach additional header information to the request. A typical form of this parameter is a valid header information line that contains pairs of fields and values separated by colons (for example, "Donttrackmehere:zip/zop;8bit").

-I.

Executes the head request instead of get.

-K

Enable the HTTP KeepAlive feature, that is, to execute multiple requests in an HTTP session. The KeepAlive feature is not enabled by default.

-N Requests

The number of requests that were executed in the test session. By default, only one request is executed, but usually the result is not representative.

-P Post-file

A file that contains the data that needs to be post.

-P Proxy-auth-username:password

Provide Basic authentication trust to a relay agent. The username and password are separated by one: and sent in the form of a base64 encoding. This string is sent regardless of whether the server needs to (that is, whether the 401 authentication requirement code is sent).

-Q

If the number of requests processed is greater than that, AB outputs a progress count for each processing of approximately 10% or 100 requests. This-Q tag can suppress this information.

-S

When used in compilation (Ab-h displays relevant information) using protected HTTPS with SSL instead of the HTTP protocol. This function is experimental, but also very simple. It's best not to use it.

-S

Neither the median value nor the standard deviation value is displayed, and a warning or error message is not displayed when the mean and median values are 1 to twice times the standard deviation value. By default, values such as minimum/mean/maximum values are displayed. (Support for previous versions).

-T TimeLimit

The maximum number of seconds that the test was made. Its intrinsic implied value is-n 50000. It can limit the testing of the server to a fixed total time. By default, there is no time limit.

-T Content-type

The Content-type header information used by the post data.

-V verbosity

Set the level of detail for display information –4 or larger values display header information, 3 or greater values can display response codes (404, 200, etc.), and 2 or greater values can display warnings and other information.

-V

Displays the version number and exits.

-W

Output the results in an HTML table format. By default, it is a table with two columns of white background width.

-X <table>-attributes

Sets the string for the <table> property. This attribute is filled in <table.

-X proxy[:p ORT]

Use a proxy server for the request.

-Y <tr>-attributes

Sets the string for the <tr> property.

-Z <td>-attributes

Set the string of <td> properties

Using the sample

So many parameters in fact you don't have to worry about the most basic care two options-c-n

Ab-c 100-n 10000 http://www.111cn.net/
Code description

-C 100 that is: the number of requests per request, the default can not exceed 1024, or you need to modify the system process restrictions.
-N 10000 is the number of concurrent connections for 1 requests, and the default maximum cannot exceed 50000.
The URL of the test will be followed by/
Return code Description

The following is a return code that handles 20 requests simultaneously and runs 10 times www.111cn.net/index.php files.

D:\apache\Apache\bin\ab-c 10-n http://www.111cn.net/
This 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/

Benchmarking www.phpddt.com (Be patient) ... done

Version information for Apache
Server software:apache/2.2.3
Server Host Name
Server Hostname:www.phpddt.com
Server disconnected
Server port:80
Test page Path
Document Path:/
Document size
Document length:37826 bytes
Concurrent number
Concurrency Level:10
Test duration
Time taken for tests:27.318 seconds
Number of requests completed
Complete requests:20
Number of failed requests
Failed requests:0
Number of Write Failures
Write errors:0
Total Network Transmission
Total transferred:765280 bytes
HTML Content Transfer Volume
HTML transferred:756520 bytes
Average number of transactions per second
Requests per second:0.73 [#/sec] (mean)
Average transaction response time
Time per request:13658.781 [MS] (mean)
Average actual elapsed time per request
Time/request:1365.878 [MS] (mean, across all concurrent requests)
The average traffic on the network per second can help eliminate the problem of excessive network traffic leading to longer response times
Transfer rate:27.36 [Kbytes/sec] Received
Decomposition of the time consumed on the network
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:265 1218 1399.5 346 3348
processing:2602 9957 3945.7 9033 14973
waiting:796 6868 3409.0 7631 11692
total:3204 11175 3709.0 10558 18175
Here is the request status
Percentage of the requests served within a certain time (MS)
50% 10558//50% in the open www.111cn.net response time is less than 10558 milliseconds, explained below
66% 13916
75% 14557
80% 14938
90% 15311
95% 18175
98% 18175
99% 18175
100% 18175 (Longest request)
Apache AB test simulation is still relatively simple, in fact there are other such as Http_load, siege and other stress testing tools.

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.