Apache server performance testing tool
If the system is not installed, use the following command to install it
#Ubuntu
sudo apt-get install apache2-utils
#centos
yum install httpd-tools
ab command is a tool for testing your Apache http server. You can use this tool to specify the number of requests sent to apache within a unit time to see how well your Apache and the machine work together.
ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value
] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [
-i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-user‐
name:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ]
[ -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port]
] [ -y <tr>-attributes ] [ -z <td>-attributes ] [http://]host‐
name[:port]/path
-A auth-username:password
# Support basic authentication certificates, use "colon" between username and password:
# Separated, ab will be sent in clear text. Regardless of whether the server needs it or not
# , which means your server needs to support 401 authentication.
-c concurrency
# The number of requests sent to the server at the same time. By default, only one http request is executed at a time.
-C cookie-name=value
# Add a Cookie: line to the request. The argument is typically in the
# form of a name=value pair. This field is repeatable.
-d # Do not display the "percentage served within XX [ms] table".
# (legacy support).
-e csv-file
# Write a Comma separated value (CSV) file which contains for each
# percentage (from 1% to 100%) the time (in milli seconds) it took to
# serve that percentage of the requests. This is usually more useful
# than the 'gnuplot' file; as the results are already 'binned'.
-ggnuplot-file
# Write all measured values out as a 'gnuplot' or TSV (Tab separate
# values) file. This file can easily be imported into packages like
# Gnuplot, IDL, Mathematica, Igor or even Excel. The labels are on
# the first line of the file.
-h #Display usage instructions
-H custom-header
#Append an additional header string to the request packet. This parameter should be a valid header line
# line) form, usually use colon ":" to separate valid pairs (valid pairs) such as 'Accept-
# Encoding: zip/zop;8 bit';
-i # Use an http header (HEAD) to replace the GET method. The POST method cannot be incorporated
-k # Allow http KeepAlive; that is to say, perform multiple requests in one http
# In the session, it is not allowed by default, that is, no KeepAlive;)
-n requests
# The number of requests issued when executing a test session. The default is to execute a single request.
# Of course, such test results are meaningless.
-p POST-file
# The test program, also known as ab, will send a request with HTTP POST to the Apache server.
-P proxy-auth-username:password
# When you need to test an HTTP server through a proxy and your proxy
# Username and password verification is also required, then you can use this option, the same
#Use a colon ":" to separate the username and password, and ab will print them in plain text.
#Send it out, of course, the premise is that your agent is in 407 authentication status
-q # When processing more than 150 requests, ab outputs a progress count
# on stderr every 10% or 100 requests or so. The -q flag will sup‐
# press these messages.
-s # When compiled in (ab -h will show you) use the SSL protected https
# rather than the http protocol. This feature is experimental and
# very rudimentary. You probably do not want to use it.
-S # Do not display the median and standard deviation values, nor dis‐
# play the warning/error messages when the average and median are
# more than one or two times the standard deviation apart. And de‐
# fault to the min/avg/max values. (legacy support).
-t timelimit
# Set the length of the test. Using this option ab will be set automatically.
# The number of test request sessions is 50000, and then the time you set is
# Fixed period. By default, there is no time limit, that is, until completion
# Until the number of requests you set.
-T content-type
# Content type header, used when POST data.
-v verbosity
# Set the redundancy level, level 4 prints out the detailed information of each request header,
# Level 3 prints out the response code (for example, 404,200), level 2 prints out warning information and instruction messages
-V # Display version number and exit
-w #Print the output results to an HTML table. The default table is two columns and n rows with a white background and a black box.
-x <table>-attributes
# Use a string to describe the attributes of the table. The attribute string should be inserted into <table here>
-X proxy[:port]
# Use a proxy server for the requests.
-y <tr>-attributes
# Attribute name (<tr>) used to generate each row of the html table
-z <td>-attributes
# Attribute name (<td>) used to generate each column of the html table
Host: The host being tested.
# 10 concurrency, 500 requests
ab -c 10 -n 500 https://www.qq.com/