AB pressure test under Linux

Source: Internet
Author: User
Tags set time cipher suite

Introduction to 1.ab

AB is the abbreviation for the Apachebench command.

AB is an Apache self-brought stress test tool. AB is very practical, it can not only the Apache server site access stress testing, or other types of servers can be stress testing. such as Nginx, Tomcat, IIS, etc.

The principle of 2.ab

AB principle: The AB command creates multiple concurrent access threads, simulating multiple visitors accessing a URL address at the same time. Its test target is URL-based, so it can be used to test the load pressure of Apache, as well as other Web servers such as Nginx, Lighthttp, Tomcat, and IIS.

The AB command is very low on the computer that emits the load, and it does not occupy a high CPU or consume a lot of memory. But it will cause a huge load on the target server, which works like a CC attack. You also need to be aware of your own testing, or too much load at a time. May cause the target server resources to run out, serious even causes the panic.

Installation of 3.ab

Yum-y Install Httpd-tools

To test whether the installation was successful:
[Email protected] html]# ab-vthis 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/

Parameter description for 4.ab

[[email protected] html]# ab--helpab:wrong number of Argumentsusage:ab [options] [http[s]://]hostname[:p ort]/    Pathoptions is:-N requests number of requests to perform-c concurrency number of multiple requests -T TimeLimit Seconds to Max.  Wait for responses-b windowsize Size of TCP send/receive buffer, in Bytes-p postfile File containing data to POST. Remember also to Set-t-u putfile File containing data to PUT.                    Remember also to set-t-T content-type content-type header for POSTing, eg.  ' application/x-www-form-urlencoded ' Default is ' text/plain '-v verbosity how much troubleshooting Info to print-w print out results in HTML tables-i use HEAD instead of Get-x attrib  Utes string to insert as table Attributes-y attributes string to insert as TR attributes-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 all normal header lines. (repeatable)-a attribute Add Basic WWW authentication, the attributes is a colon separated user    Name and password. -P attribute Add Basic Proxy authentication, the attributes is a colon separated username and PASSW    Ord.  -X Proxy:port ProxyServer and port number to Use-v Print version number and exit-k use    HTTP KeepAlive feature-d do not show percentiles served table.    -S do not show confidence estimators and warnings.    -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(see OpenSSL ciphers)-F Protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or all) 

Detail Description:

-N The number of requests executed in the test session. By default, only one request is executed. Total number of requests

-c The number of requests produced at a time. The default is one at a time. Requested amount of users

The maximum number of seconds that the-t test takes. Its internal implied value is-n 50000, which allows the server to be tested in a fixed total time limit. By default, there is no time limit.

-V Displays the version number and exits.

5. Performance indicators

5.1 Throughput (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 sentence represents two meanings: A, the throughput rate and the number of concurrent users B, the number of concurrent users, the throughput rate is generally different calculation formula: Total number of requests/processing time spent to complete these requests, that is, request per Second=complete Requests/time Taken for tests must indicate that this value represents the overall performance of the current machine, and the larger the value the better.

5.2 Concurrent connections (the number of concurrent connections)

The number of concurrent connections refers to the number of requests received by the server at some point, simply speaking, is a session.

5.3 Concurrent Users (Concurrency level)

To be aware of the difference between this concept and the number of concurrent connections, a user may produce multiple sessions at the same time, that is, the number of connections. Under http/1.1, IE7 supports two concurrent connections, IE8 supports 6 concurrent connections, FIREFOX3 supports 4 concurrent connections, so our number of concurrent users will have to be divided by this cardinality accordingly.

5.4 Average user request latency (time per request)

Calculation formula: The amount of time spent processing all requests (total requests/concurrent users), which is: Request=time taken for tests/(full requests/concurrency level)

5.5 Server average Request latency (time per request:across all concurrent requests)

Calculation formula: The amount of time/total requests that are processed to complete all requests, that is, when taken for/testscomplete requests can see that it is the reciprocal of the throughput rate. At the same time, it is equal to the average user request waiting time/number of concurrent users, that is, the times per request/concurrency level

Application of 6.ab

The command parameters of AB are more, and we often use the-C and-n parameters.

Ab-c 10-n http://www.myvick.cn/index.php: Simultaneous processing of 100 requests and running 10 times index.php

-C10 indicates that the number of concurrent users is 10

-N100 indicates that the total number of requests is 100

[[email protected] html]# ab-c 10-n http://www.myvick.cn/index.phpThis is apachebench, Version 2.3 < $Revisio n:655654 $>copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/Licensed to the Apache software Fou Ndation, http://www.apache.org/Benchmarking www.myvick.cn (Be patient) ... doneserver software:nginx/1.13.6 #测试服          Name of server Hostname:www.myvick.cn #请求的URL主机名Server port:80 #web服务器监听的端口Document Path: /index.php #请求的URL中的根绝对路径, with the suffix of the file, we can generally understand the type of the request document length:799 bytes #HTTP响应数据的正文长度Concurre Ncy Level:10 # Number of concurrent users, this is one of the parameters we set time taken for tests:0.668 seconds #所有这些请求被处理完成所花费的总时间 unit seconds complete Reque STS:100 # Total number of requests, this is one of the parameters we set failed requests:0 # indicates the number of failed requests, where the failure is the request in connection with the server, send data and other links in the event of an exception, and no response The condition of the timeout is write errors:0total transferred:96200 bytes #所有请求的响应数据长度总和.   Includes header information for each HTTP response data and length of body data HTML transferred:79900 bytes # The sum of the body data in all the requested response data, that is, the length of the header information in the HTTP response data in total transferred is subtracted requests per second:149.71 [#/sec] (mean) #吞吐率, calculation formula: Compl  Ete Requests/time taken for tests total number of requests/time taken to complete the number of requests per request:66.797 [MS] (mean) # User average request wait time, calculation formula: Times Token for tests/(complete requests/concurrency level). Time taken to complete all requests/(total requests/concurrent users) request:6.680 [MS] (mean, across all concurrent requests) #服务器平均请求等待时间, calculation formula: Ti The me taken for Tests/complete requests is exactly the inverse of the throughput rate. You can also count: Time per request/concurrency leveltransfer rate:140.64 [kbytes/sec] received #表示这些请求在单位时间内从服务器获取的数据长度, count Calculate formula: Total Trnasferred/time taken for tests, this statistic is very good to explain the server's processing ability reaches the limit, its export broadband demand.     Connection times (ms) min MEAN[+/-SD] Median maxconnect:1 2 0.7 2 5Processing: 2 81.3 3 615waiting:1 81.3 3 615total:3 81.3 6 618Percenta GE of the requests served within a certain time (ms) 50% 6 66% 6 75% 7 80% 7 90% 95% 209 98% 209 99% 618 100% 618 (longest request) 

#Percentage of requests served within a certain time (MS) This data is used to describe the distribution of processing times per request, such as the above test, 80% of the request processing time is not more than 7ms, This processing time refers to the preceding time per request, that is, for a single user, the average process

7 Nginx vs Apache

Nginx performance is indeed higher than Apache performance. Nginx throughput is greater than Apache, and the larger the throughput the better

AB pressure test under Linux

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.