ab ab load may detect a stress test at the corresponding interface number of users capable of carrying linux

ab stress test under linux

 

Introduction of 1.ab

   ab is apachebench command abbreviations.

   ab is the stress test tool comes with apache. ab very practical, it can not only access the site on the apache server stress tests, may also be pressure tested or other types of servers. Such as nginx, tomcat, IIS, etc.

2.ab principle

   ab principle: ab command creates multiple concurrent threads access, multiple visitors simultaneously to simulate a URL address to access. Its goal is to test based on the URL, so that both can be used to load stress testing apache can also test nginx, pressure lighthttp, tomcat, IIS and other Web servers.

   ab command issued computers require very low load, it neither occupy high CPU, it will not take up a lot of memory. But it will cause huge target server load, the principle is similar to CC attack. Test yourself using also need to pay attention, otherwise too much time on load. May cause the target server resource depletion, severe and even lead to crashes.

3.ab installation

   yum -y install httpd-tools

Test whether the installation was successful: 
[root @ VIC HTML] # ab -V This IS ApacheBench, Version 2.3 <$ Revision: 655 654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to at The Apache Software Foundation, http://www.apache.org/

4.ab parameter description

Copy the code
[root@vic html]# ab --help
ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -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 attributes   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
                    are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
                    are a colon separated username and password.
    -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)
Copy the code

Details Description:

-N the number of requests in the test session performed. By default, perform a single request. The total number of requests

-c produced a number of requests. Default is one. User requested amount

-t maximum number of seconds the tests carried out. Which implies an internal -n 50000, which allows the server to test within a limited fixed total time. By default, there is no time limit.

-V Display version number and exit.

5. Performance indicators

5.1 Throughput (Requests per second)

Copy the code
Server capabilities concurrent processing described quantization unit is reqs / s, refers to the number of requests processed per unit time at a certain number of concurrent users. The maximum number of requests at a certain number of concurrent users that can be processed per unit of time, called maximum throughput. 
Remember: Throughput is based on the number of concurrent users. This sentence represents two meanings: 
A, throughput, number of concurrent users and related 
B, different number of concurrent users, the throughput is generally different from 
the formula: Total number of requests / the number of requests processed time spent, i.e. 
Request per second = Complete requests / Time taken for tests 
must be noted, this value indicates the current overall performance of the machine, the better the value.
Copy the code

5.2 concurrent (The number of concurrent connections) are connected

    The number of concurrent connections means that at some point the number of requests received by the server, simply speaking, is a conversation.

5.3 the number of concurrent users (Concurrency Level)

   Important to distinguish the difference between the concept and the number of concurrent connections, a user may simultaneously generate multiple sessions, i.e. the number of connections. In HTTP / 1.1, IE7 supports two concurrent connections, IE8 support six simultaneous connections, FireFox3 supports four concurrent connections, so Accordingly, we have to divide the number of concurrent users of this base.

5.4 average user request waiting time (Time per request)

Calculated: number of requests processed all the time spent / (total number of requests / number of concurrent users), namely: 
Time = Time taken per Request for Tests / (Complete Requests / Concurrency Level)

5.5 server average request waiting time (Time per request: across all concurrent requests)

Calculated: number of requests processed all the time spent / total number of requests, i.e.: 
Time taken for / testsComplete Requests 
can see that it is the inverse of throughput. 
At the same time, it is equal to the average user request waiting time / number of concurrent users, i.e., 
Time per request / Concurrency Level

6.ab applications

   ab command parameters more, we often use the -c and -n parameters.

   ab -c 10 -n 100 http://www.myvick.cn/index.php: 100 requests processed simultaneously and run 10 times index.php

  -c10 10 represents the number of concurrent users

  100 represents the total number of requests -n100

Copy the code
[@ VIC the root HTML] ab & # 100 http://www.myvick.cn/index.php -C 10 -n 
This IS ApacheBench, Version 2.3 <$ Revision: 655 654 $> 
Copyright 1996 Adam Twiss, the Zeus Technology Ltd is an, HTTP : //www.zeustech.net/ 
Licensed to the Apache Software Foundation at The, http://www.apache.org/ 

Benchmarking www.myvick.cn (BE Patient) ..... DONE 


Server Software: nginx / 1.13.6 # test server name 
server hostname: URL hostname www.myvick.cn # request 
server port: 80 #web server listening on port 

document path: URL of the root absolute path /index.php # requests, adoption of the document extension, we can understand the general type of the request 
Document length: 799 bytes #HTTP body length response data 

concurrency Level: 10 # number of concurrent users, it is one of the parameters we set
Time taken for tests: 0.668 seconds # Total units of time all these requests are processed takes seconds 
Complete requests: 100 # of total number of requests, which is one of the parameters we set 
Failed requests: 0 # represents the number of failed requests, here refers to abnormal request failed, and the case where no response timeout occurs in the server connection, the data transmission and other aspects of 
the Write errors: 0 
the Total Transferred: # 96200 bytes in response to the sum of the length of all the requested data. Each HTTP response data comprising header information and body data length of 
HTML transferred: 79900 bytes # of the sum of all the text data in response to the data request, i.e. by subtracting the length of the header information in the HTTP response Total transferred data 
Requests per second: 149.71 [# / sec] (mean) # throughput, calculated: complete requests / time taken for tests the total number of requests / the number of requests processed time spent 
time per request: 66.797 [ms] (mean) # The average time a user request waiting, calculated: time token for tests / (Complete requests / Concurrency Level). The number of requests processed all the time spent / (total number of requests / concurrent users)
Time per request: 6.680 [ms] (mean, across all concurrent requests) # server average request waiting time, calculated: Time taken for tests / Complete requests , exactly the inverse of throughput. It can be so Statistics: Time per Request / Concurrency Level 
Transfer Rate: 140.64 [Kbytes / sec] Received # represents the data length of the request acquired from the server within a unit time, calculated: Total trnasferred / Time taken for tests , this statistic is when good explanation of the processing power of the server reaches the limit, the demand for its exports of broadband. 

Times Connection (MS) 
              min Mean [+/- SD] Median max 
Connect: 2. 5. 1 2 0.7 
Processing: 81.3. 3 615 2 26 is 
Waiting: 81.3. 3. 1 615 26 is 
the Total: 81.3. 6. 3 618 28 

Percentage of Requests The served WITHIN A Time Certain (MS) 
  50%. 6 
  66. 6% 
  75%. 7
  . 7% 80 
  90% 10 
  95% 209 
  98% 209 
  99% 618 
 100% 618 (longest Request) 

#Percentage of Requests served WITHIN A Certain Time (MS) This section describes the distribution of data for each request processing time, such as above tests, 80% of the time is not more than 7ms request processing, the processing time is in front of the time per request, i.e., for a single user, the average processing time for each request
Copy the code

 7 nginx and Comparative apache

  nginx performance is indeed higher than the apache performance. apache nginx throughput greater than the throughput the better

 

Reference: http: //www.jb51.net/article/59469.htm

     http://blog.csdn.net/caotianyin/article/details/49253055

Introduction of 1.ab

   ab is apachebench command abbreviations.

   ab is the stress test tool comes with apache. ab very practical, it can not only access the site on the apache server stress tests, may also be pressure tested or other types of servers. Such as nginx, tomcat, IIS, etc.

2.ab principle

   ab principle: ab command creates multiple concurrent threads access, multiple visitors simultaneously to simulate a URL address to access. Its goal is to test based on the URL, so that both can be used to load stress testing apache can also test nginx, pressure lighthttp, tomcat, IIS and other Web servers.

   ab command issued computers require very low load, it neither occupy high CPU, it will not take up a lot of memory. But it will cause huge target server load, the principle is similar to CC attack. Test yourself using also need to pay attention, otherwise too much time on load. May cause the target server resource depletion, severe and even lead to crashes.

3.ab installation

   yum -y install httpd-tools

Test whether the installation was successful: 
[root @ VIC HTML] # ab -V This IS ApacheBench, Version 2.3 <$ Revision: 655 654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to at The Apache Software Foundation, http://www.apache.org/

4.ab parameter description

Copy the code
[root@vic html]# ab --help
ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -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 attributes   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
                    are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
                    are a colon separated username and password.
    -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)
Copy the code

Details Description:

-N the number of requests in the test session performed. By default, perform a single request. The total number of requests

-c produced a number of requests. Default is one. User requested amount

-t maximum number of seconds the tests carried out. Which implies an internal -n 50000, which allows the server to test within a limited fixed total time. By default, there is no time limit.

-V Display version number and exit.

5. Performance indicators

5.1 Throughput (Requests per second)

Copy the code
Server capabilities concurrent processing described quantization unit is reqs / s, refers to the number of requests processed per unit time at a certain number of concurrent users. The maximum number of requests at a certain number of concurrent users that can be processed per unit of time, called maximum throughput. 
Remember: Throughput is based on the number of concurrent users. This sentence represents two meanings: 
A, throughput, number of concurrent users and related 
B, different number of concurrent users, the throughput is generally different from 
the formula: Total number of requests / the number of requests processed time spent, i.e. 
Request per second = Complete requests / Time taken for tests 
must be noted, this value indicates the current overall performance of the machine, the better the value.
Copy the code

5.2 concurrent (The number of concurrent connections) are connected

    The number of concurrent connections means that at some point the number of requests received by the server, simply speaking, is a conversation.

5.3 the number of concurrent users (Concurrency Level)

   Important to distinguish the difference between the concept and the number of concurrent connections, a user may simultaneously generate multiple sessions, i.e. the number of connections. In HTTP / 1.1, IE7 supports two concurrent connections, IE8 support six simultaneous connections, FireFox3 supports four concurrent connections, so Accordingly, we have to divide the number of concurrent users of this base.

5.4 average user request waiting time (Time per request)

Calculated: number of requests processed all the time spent / (total number of requests / number of concurrent users), namely: 
Time = Time taken per Request for Tests / (Complete Requests / Concurrency Level)

5.5 server average request waiting time (Time per request: across all concurrent requests)

Calculated: number of requests processed all the time spent / total number of requests, i.e.: 
Time taken for / testsComplete Requests 
can see that it is the inverse of throughput. 
At the same time, it is equal to the average user request waiting time / number of concurrent users, i.e., 
Time per request / Concurrency Level

6.ab applications

   ab command parameters more, we often use the -c and -n parameters.

   ab -c 10 -n 100 http://www.myvick.cn/index.php: 100 requests processed simultaneously and run 10 times index.php

  -c10 10 represents the number of concurrent users

  100 represents the total number of requests -n100

Copy the code
[@ VIC the root HTML] ab & # 100 http://www.myvick.cn/index.php -C 10 -n 
This IS ApacheBench, Version 2.3 <$ Revision: 655 654 $> 
Copyright 1996 Adam Twiss, the Zeus Technology Ltd is an, HTTP : //www.zeustech.net/ 
Licensed to the Apache Software Foundation at The, http://www.apache.org/ 

Benchmarking www.myvick.cn (BE Patient) ..... DONE 


Server Software: nginx / 1.13.6 # test server name 
server hostname: URL hostname www.myvick.cn # request 
server port: 80 #web server listening on port 

document path: URL of the root absolute path /index.php # requests, adoption of the document extension, we can understand the general type of the request 
Document length: 799 bytes #HTTP body length response data 

concurrency Level: 10 # number of concurrent users, it is one of the parameters we set
Time taken for tests: 0.668 seconds # Total units of time all these requests are processed takes seconds 
Complete requests: 100 # of total number of requests, which is one of the parameters we set 
Failed requests: 0 # represents the number of failed requests, here refers to abnormal request failed, and the case where no response timeout occurs in the server connection, the data transmission and other aspects of 
the Write errors: 0 
the Total Transferred: # 96200 bytes in response to the sum of the length of all the requested data. Each HTTP response data comprising header information and body data length of 
HTML transferred: 79900 bytes # of the sum of all the text data in response to the data request, i.e. by subtracting the length of the header information in the HTTP response Total transferred data 
Requests per second: 149.71 [# / sec] (mean) # throughput, calculated: complete requests / time taken for tests the total number of requests / the number of requests processed time spent 
time per request: 66.797 [ms] (mean) # The average time a user request waiting, calculated: time token for tests / (Complete requests / Concurrency Level). The number of requests processed all the time spent / (total number of requests / concurrent users)
Time per request: 6.680 [ms] (mean, across all concurrent requests) # server average request waiting time, calculated: Time taken for tests / Complete requests , exactly the inverse of throughput. It can be so Statistics: Time per Request / Concurrency Level 
Transfer Rate: 140.64 [Kbytes / sec] Received # represents the data length of the request acquired from the server within a unit time, calculated: Total trnasferred / Time taken for tests , this statistic is when good explanation of the processing power of the server reaches the limit, the demand for its exports of broadband. 

Times Connection (MS) 
              min Mean [+/- SD] Median max 
Connect: 2. 5. 1 2 0.7 
Processing: 81.3. 3 615 2 26 is 
Waiting: 81.3. 3. 1 615 26 is 
the Total: 81.3. 6. 3 618 28 

Percentage of Requests The served WITHIN A Time Certain (MS) 
  50%. 6 
  66. 6% 
  75%. 7
  . 7% 80 
  90% 10 
  95% 209 
  98% 209 
  99% 618 
 100% 618 (longest Request) 

#Percentage of Requests served WITHIN A Certain Time (MS) This section describes the distribution of data for each request processing time, such as above tests, 80% of the time is not more than 7ms request processing, the processing time is in front of the time per request, i.e., for a single user, the average processing time for each request
Copy the code

 7 nginx and Comparative apache

  nginx performance is indeed higher than the apache performance. apache nginx throughput greater than the throughput the better

 

Reference: http: //www.jb51.net/article/59469.htm

     http://blog.csdn.net/caotianyin/article/details/49253055

Guess you like

Origin www.cnblogs.com/kevin-yang123/p/12608193.html