ab stress test stress test under linux apache bench

root@platform-adsproxyapi-deployment-5dd7fbfbc7-x7cgl:/app# apt-get install apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libapr1 libaprutil1
The following NEW packages will be installed:
  apache2-utils libapr1 libaprutil1
0 upgraded, 3 newly installed, 0 to remove and 22 not upgraded.
Need to get 400 kB of archives.
After this operation, 905 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.163.com/debian stretch/main amd64 libapr1 amd64 1.5.2-5 [96.6 kB]
Get:2 http://mirrors.163.com/debian stretch/main amd64 libaprutil1 amd64 1.5.4-3 [85.8 kB]
Get:3 http://mirrors.163.com/debian-security stretch/updates/main amd64 apache2-utils amd64 2.4.25-3+deb9u9 [218 kB]
Fetched 400 kB in 11s (34.7 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libapr1:amd64.
(Reading database ... 22004 files and directories currently installed.)
Preparing to unpack .../libapr1_1.5.2-5_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-5) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../libaprutil1_1.5.4-3_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-3) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.25-3+deb9u9_amd64.deb ...
Unpacking apache2-utils (2.4.25-3+deb9u9) ...
Setting up libapr1:amd64 (1.5.2-5) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up libaprutil1:amd64 (1.5.4-3) ...
Setting up apache2-utils (2.4.25-3+deb9u9) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
root@platform-adsproxyapi-deployment-5dd7fbfbc7-x7cgl:/app# ab -n 1000
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 at a time
    -t timelimit    Seconds to max. to spend on benchmarking
                    This implies -n 50000
    -s timeout      Seconds to max. wait for each response
                    Default is 30 seconds
    -b windowsize   Size of TCP send/receive buffer, in bytes
    -B address      Address to bind to when making outgoing connections
    -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 to use for POST/PUT data, 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.
    -q              Do not show progress when doing more than 150 requests
    -l              Accept variable document length (use this for dynamic pages)
    -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.
    -m method       Method name
    -h              Display usage information (this message)
    -I              Disable TLS Server Name Indication (SNI) extension
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol
                    (TLS1, TLS1.1, TLS1.2 or ALL)
root@platform-adsproxyapi-deployment-5dd7fbfbc7-x7cgl:/app# ab -n 1000 -c 2 http://platform-adsproxyapi/api/Ops/TestProxy
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking platform-adsproxyapi (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Kestrel
Server Hostname:        platform-adsproxyapi
Server Port:            80

Document Path:          /api/Ops/TestProxy
Document Length:        95 bytes

Concurrency Level:      2
Time taken for tests:   226.142 seconds
Complete requests:      1000
Failed requests:        832
   (Connect: 0, Receive: 0, Length: 832, Exceptions: 0)
Total transferred:      269848 bytes
HTML transferred:       85848 bytes
Requests per second:    4.42 [#/sec] (mean)
Time per request:       452.283 [ms] (mean)
Time per request:       226.142 [ms] (mean, across all concurrent requests)
Transfer rate:          1.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.0      0      25
Processing:    65  452 871.9     86    3337
Waiting:       65  451 872.0     86    3337
Total:         65  452 871.9     86    3337

Percentage of the requests served within a certain time (ms)
  50%     86
  66%     97
  75%    109
  80%    131
  90%   1449
  95%   3032
  98%   3107
  99%   3191
 100%   3337 (longest request)
root@platform-adsproxyapi-deployment-5dd7fbfbc7-x7cgl:/app# 

  

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

apt-get install apache2-utils

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

apt-get install apache2-utils

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 # All requests are processed the total time spent in the second unit
Complete requests: Total number of requests # 100, which is one of the parameters we set 
Failed requests: 0 # represents the number of failed requests, failures herein refers to an abnormal, and no connection to the server in response to a request occurs, transmit data after a timeout, and other aspects the case where 
the Write errors: 0 
the Total Transferred: # 96200 bytes in response to the sum of the data lengths of all the requests. 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/panpanwelcome/p/12141923.html