Table of Contents
Explanation of the web stress testing tool apache -ab
Articles you may be interested in
Home Backend Development PHP Tutorial Web stress testing tool apache -ab explained_PHP tutorial

Web stress testing tool apache -ab explained_PHP tutorial

Jul 13, 2016 am 10:21 AM
apache web pressure test

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://&lt;server IP or domain name&gt;/server-status), or view the Apache configuration file (ServerVersion: Apache/&lt;version number&gt;).

How to view the apache version How to view the apache version Apr 13, 2025 pm 01:00 PM

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

How to solve the problem that apache cannot be started How to solve the problem that apache cannot be started Apr 13, 2025 pm 01:21 PM

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

See all articles