Web stress testing tool apache -ab explained_PHP tutorial

WBOY
Release: 2016-07-13 10:21:13
Original
800 people have browsed it

Explanation of the web stress testing tool apache -ab

Many web stress testing tools are now paid, but apache comes with a free stress testing tool, the ab tool (Order). Specifically, you can find an ab.exe file in the bin directory under the root directory of Apache. Use it to roughly test the performance of your own program.

The specific usage is as follows, excerpted from the Internet. If there are any errors, please correct them.

Format

ab [options] [http://]hostname[:port]/path

Parameters

-n requests Number of requests to perform
//The number of requests executed in the test session. By default, only one request is executed

-c concurrency Number of multiple requests to make
//The number of requests generated at one time. The default is one at a time.

-t timelimit Seconds to max. wait for responses
//Maximum number of seconds for the test to take place. Its internal implicit value is -n 50000. It can limit the testing of the server to a fixed total time. By default, there is no time limit.

-p postfile File containing data to POST
//File containing data that needs to be POSTed.

-T content-type Content-type header for POSTing
//Content-type header information used by POST data.

-v verbosity How much troubleshooting info to print
//Set the verbosity of displayed information - 4 or greater will display header information, 3 or greater will display response codes (404, 200, etc.), 2 or greater will display warnings and other information. -V Display version number and exit.

-w Print out results in HTML tables
//Output the results in HTML table format. By default, it is a two-column width table with a white background.

-i Use HEAD instead of GET
//Perform HEAD request 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)
//-C cookie-name=value Attach a Cookie: line to the request. Its typical form is a parameter pair of name=value. This parameter can be repeated.

-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.

//-P proxy-auth-username:password Provides BASIC authentication trust to a relay proxy. The username and password are separated by a : and sent in base64 encoding. This string will be sent regardless of whether the server requires it (i.e. whether a 401 authentication requirement code is sent).

-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
-h Display usage information (this message)
//-attributes Set the string of attributes. There are various statically declared fixed-length buffers in the defective program. Additionally, the parsing of command line arguments, server response headers, and other external input is trivial, which can have undesirable consequences. It is not a complete implementation of HTTP/1.x; it only accepts certain 'expected' response formats. Frequent use of strstr(3) may cause performance issues, i.e., you may be testing the performance of ab rather than the server.
There are many parameters, generally we just use -c and -n parameters. For example:
Open cmd and enter the following code.
cd C:Apache2.2bin
ab -n 1000 -c 100 [url]http://zf.guqin.com/index/index[/url]
This means handling 100 requests simultaneously and running the index.php file 1000 times. Here's what it prints out.
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, [url]http://www.zeustech.net/[/url]
Copyright (c) 1998-2002 The Apache Software Foundation, [url]http://www.apache.org/[/url]
Benchmarking 127.0.0.1 (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
Finished 1000 requests
Server Software: Apache/2.2.8
//Platform apache version 2.2.8
Server Hostname: zf.guqin.com
//Server host name
Server Port:         80
//Server port
Document Path: /index.php
//Test page document
Document Length: 1018 bytes
//Document size
Concurrency Level: 1000
//Concurrency count
Time taken for tests: 8.188731 seconds
//The duration of the entire test
Complete requests: 1000
//Number of completed requests
Failed requests: 0
//Number of failed requests
Write errors:         0
Total transferred: 1361581 bytes
//Network transmission volume in the entire scene
HTML transferred: 1055666 bytes
//HTML content transmission volume in the entire scene
Requests per second: 122.12 [#/sec] (mean)
//One of the indicators that everyone is most concerned about is equivalent to the number of transactions per second in LR. The mean in parentheses indicates that this is an average value
Time per request: 8188.731 [ms] (mean)
//The second indicator that everyone is most concerned about is equivalent to the average transaction response time in LR. The mean in parentheses indicates that this is an average value
Time per request: 8.189 [ms] (mean, across all concurrent requests)
//Average of actual running time of each request
Transfer rate: 162.30 [Kbytes/sec] received
//The average traffic on the network per second can help eliminate whether there is a problem that excessive network traffic leads to prolonged response time
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 646 1078.7 89 3291
Processing: 165 992 493.1 938 4712
Waiting: 118 934 480.6 882 4554
Total: 813 1638 1338.9 1093 7785
//The decomposition of time spent on the network, the specific algorithm of each data is not very clear
Percentage of the requests served within a certain time (ms)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (longest request)
//Response status of all requests in the entire scenario. In the scenario, each request has a response time, 50% of the user response time is less than 1093 milliseconds, 60% of the user response time is less than 1247 milliseconds, and the maximum response time is less than 7785 milliseconds
Since for concurrent requests, the CPU does not actually process them at the same time, but rotates them one by one according to the time slice obtained by each request, so basically the first Time per request time is approximately equal to the second Time per request time multiplied by Number of concurrent requests.

Articles you may be interested in

  • The ten best web website performance testing software tools
  • php bom removal tool, php batch removal of bom code
  • Poll shows most Americans predict Obama will be re-elected
  • The classic dialogue between programmers and testers. These are summarized and shared by foreign programmers, saying they are universally applicable?
  • A collection of web front-end development gadgets
  • js gets the height of the scroll bar from the top and bottom of the browser, compatible with ie and firefox
  • php pushes elements into the array head ( Usage of array_unshift)
  • Software test engineer career introduction and planning

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/860675.htmlTechArticleWeb stress testing tool apache -ab explains that many web stress testing tools are paid now, but apache comes with it A free stress testing tool, the ab tool (command). Specifically...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!