Pressure test on the server using AB pressure tool

Source: Internet
Author: User
Tags first row port number server port

Before using, you need to verify that the server has Apache Http Server installed, and if it is not installed, you need to first install:

$ sudo yum install httpd
$ ab-v
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/

The following is an explanation of some of the commonly used parameters for AB tools

aicode:~ mylxsw$ ab-h
Usage:ab [Options] [http[s]://]hostname[:p Ort]/path
Options are:
-N requests number of requests to execute
-C Concurrency Concurrent request quantity
-B windowsize TCP Send/Receive buffer size, unit so byte
-P postfile Specifies the data file sent by post, and do not forget to set the-t parameter
-U putfile Specify the data file to send, and do not forget to set the-t parameter
-T content-type specifies the Content-type request header when sending data using Post/put, for example.
' Application/x-www-form-urlencoded '
Default is ' Text/plain '
-W output results as HTML table
-I request method using head instead of get
-C attribute to add cookies, such as ' apache=1234 '. (You can repeat settings)
-H attribute to add any request header, for example. ' Accept-encoding:gzip ' (Repeatable settings)
-A attribute to add basic WWW authentication information, which is a comma-separated username and password in English
-P attribute to add Proxy server authentication information, use commas to separate user names and passwords
-X proxy:port Specifies the address and port number of the proxy server
-K uses the HTTP keepalive attribute
-R do not exit when the socket receives an error message.
-Z Ciphersuite Specify SSL/TLS encryption Kit
-F Protocol Specifies SSL/TLS protocol (SSL2, SSL3, TLS1 or All)
...

If we need to perform a stress test on http://letv.com, the total number of specified requests is 100 and the number of concurrent users is 10, we can test them in the following way

$ ab-n 100-c http://letv.com/
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 letv.com (Be patient) ... done


Server software:nginx/1.2.1
Server Hostname:letv.com
Server port:80

Document Path:/
Document length:184 bytes

Concurrency level:     
Time taken for tests:   0.396 seconds
Complete requests:     
Failed requests:        0
Write errors:           0
non-2xx responses:      
Total transferred:      37300 bytes
HTML transferred:        18400 bytes
Requests per second:    252.29 [#/sec] (mean)
request:       39.637 [MS] (mean)
time per request:        3.964 [MS] (mean, across all concurrent requests)
Transfer rate:       & nbsp;  91.90 [Kbytes/sec] received

Connection times (ms)
              min   MEAN[+/-SD] median   Max
connect:        4     5   0.9      5       8
Processing:      4   33  87.4      6     312
waiting:        4   33  87.3      5      311
total:          9   39   87.6     12     317

Percentage of the requests served within a certain time (MS)
50% 12
66% 12
75% 13
80% 14
90% 15
95% 316
98% 317
99% 317
100% 317 (Longest request)

Several fields to note are

Requests per second throughput (REQS/S), which is a value of 252.29, indicating the number of requests that the server can handle each second.
When the average request processing time for per request is seen, the field is divided into two rows, with two different values representing the time required to process each request, but the first row is 10 times times the second row. This is because we specify a concurrent quantity of 10, the first behavior is time-consuming for each concurrent request, and the second behavior is time-consuming for each request, so the first row value is multiplied by the number of concurrent requests for the second row. You can try to change the concurrency number to 20, and you'll see that the first row is 20 times times the second row.
Transfer rate the length of data fetched per second from the server.

The above is described in Linux, the following look at the Windows environment Apache Server pressure test Tool AB use instructions

In the Apache server with a test program Ab.exe can be very convenient to use.

Enter cmd, then enter the Ab.exe directory

command is ab-c request number-n thread number URL (recommended to enter the target page) ...

The number of threads should not be too large according to your computer's ability to withstand ...

Example: Ab-n 10-c http://192.168.1.3/index.html

The results are as follows.


D:apachebin>ab-n 10-c http://192.168.1.3/index.html
(above is the command entered)

Benchmarking 192.168.1.3 (Be patient) ... done
Server software:apache/2.0.63
(Target server Apache version number)

Server hostname:192.168.1.3
(Target server host header name)

Server port:80
(Destination server Apache port)

Document Path:/index.html
(target page relative address)

Document length:292 bytes
(Destination page size)

Concurrency Level:10
(Number of concurrent threads)

Time taken for tests:0.140625 seconds
(Use time)

Complete requests:10
(Number of successful requests)

Failed requests:0
(number of failed requests)

Write errors:0
(Number of errors occurred)

Total transferred:5750 bytes
(Total use of traffic)

HTML transferred:2920 bytes
(Traffic used by HTML files)

Requests per second:71.11 [#/sec] (mean)
(indicator one average number of requests per second)

Time per request:140.625 [MS] (mean)
(indicator two average transaction response time)

Time/request:14.063 [MS] (mean, across all concurrent requests)
(Request time per second)

Transfer rate:35.56 [Kbytes/sec] Received
(Transfer rate)

Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 0 0.0 0 0
PROCESSING:109 124 16.3 140 140
WAITING:109 124 16.3 140 140
TOTAL:109 124 16.3 140 140
(response of all requests)

Percentage of the requests served within a certain time (MS)
50% 140
66% 140
75% 140
80% 140
90% 140
95% 140
98% 140
99% 140
100% 140 (Longest request)

Each request has a response time.

For example, 50% of the user response time is less than 140 milliseconds.
The maximum response time is less than 140 milliseconds (100%).

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.