Linux Common Network Tools: HTTP stress Test AB

Source: Internet
Author: User

AB's full name is Apache Bench, which is Apache's own network stress test tool, which is the simplest and most versatile of the Http stress testing tools I know compared to LR and JMeter.

The AB command is very low on the computer that emits the load, does not consume very high CPU and memory, but can also generate a huge load on the target server, which can achieve the basic stress test.

In the case of stress testing, it is best to use the switch directly with the server for maximum network throughput.

The installation of AB is simple, the installation of Apache will be installed automatically, if you want to install AB separately, you can use Yum installation:

Yum-y Install Httpd-tools

AB command options

The most basic parameters of the AB command are-N and-C:

-n number of requests executed by -C concurrent Requests

Other parameters:

-Themaximum number of seconds that the T test takes-p contains the file that needs the data for the post -T post data using the Content-type header information -K Enable HTTP KeepAlive feature, That is, multiple requests are executed in an HTTP session, and the KeepAlive feature is not enabled by default

command example:

 +  http://www.baidu.com/

AB Performance Index

Using the results of the AB command test, you can refer to the Chinese explanation:

Document Path:/# # #请求的资源Document Length:50679bytes # # #文档返回的长度, excluding the corresponding head concurrency level: the# # #并发个数Time taken forTests30.449seconds # # #总请求时间Complete requests: the# # #总请求数Failed requests:0# # #失败的请求数Write errors:0Total Transferred:152745000Byteshtml Transferred:152037000bytesrequests per second:98.52[#/sec] (mean) # # #平均每秒的请求数Time per request:30449.217[MS] (mean) # # #平均每个请求消耗的时间Time per request:10.150[MS] (mean, across all concurrent requests) # # #上面的请求除以并发数Transfer Rate:4898.81[kbytes/sec] received # # #传输速率Connection times (ms) min mean[+/-SD] Median Maxconnect:2    Wu  27.1      -      98Processing:Wuyi 8452 5196.8   7748   30361Waiting: - 6539 5432.8   6451   30064Total: Wu 8506 5210.5   7778   30436Percentage of the requests served within a certain time (MS) -%7778### -%requests are completed within 7778Ms the%11059   the%11888   the%12207   -%13806   the%18520  98%24232   About%24559  -%30436(Longest request)

The results of the stress tests focus on throughput rates (requests per second), average user request latency (time per request) metrics:

1. Throughput rate (requests per second):

A quantitative description of the server concurrency processing capability, in REQS/S, which refers to the number of requests processed per unit of time in a concurrent user. The maximum number of requests per unit of time that a concurrent user could process, called the maximum throughput rate.

Remember: The throughput rate is based on the number of concurrent users. This statement represents two meanings:

A, throughput rate and number of concurrent users

b, different number of concurrent users, the throughput rate is generally different

Calculation formula: Total number of requests/time taken to complete these requests, i.e.

Request per second=complete Requests/time taken for tests

It is important to note that this value represents the overall performance of the current machine, and the larger the value the better.

2. Average user request wait time (times per request):

Calculation formula: The amount of time spent processing all requests (total number of requests/concurrent users), i.e.:

Time per request=time taken for tests/(complete requests/concurrency level)

3. Average Server request Wait time (Request:across all concurrent requests):

Calculation formula: The amount of time/Total requests processed to complete all requests, namely:

Time taken For/testscomplete requests

As you can see, it is the reciprocal of the throughput rate.

It also equals the average request waiting time/number of concurrent users, i.e.

Time per request/concurrency level.

Record, for the better of myself!

Linux Common Network Tools: HTTP stress Test AB

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.