/*****************by garcon1986**********************/
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.
ab是一个对Apache超文本传输协议服务器进行基准测试的工具。它对于Apache的性能给予一个基本印象。尤其显示了每秒钟能够处理请求的数量。
Synopsis
大纲:
ab [ -A auth-username :password ] [ -b windowsize ] [ -c concurrency ] [ -C cookie-name =value ] [ -d ] [ -e csv-file ] [ -f protocol ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [ -i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-username :password ] [ -q ] [ -r ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -u PUT-file ] [ -v verbosity ] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy [:port ] ] [ -y <tr>-attributes ] [ -z <td>-attributes ] [ -Z ciphersuite ] [http[s]://]hostname [:port ]/path
Options
选项:
-A auth-username :password
Supply BASIC Authentication credentials to the server. The username and password are separated by a single : and sent on the wire base64 encoded. The string is sent regardless of whether the server needs it (i.e. , has sent an 401 authentication needed).
支持对服务器的基本验证。用':'把用户名和密码分隔,并通过base64加密后发送。
-b windowsize
Size of TCP send/receive buffer, in bytes.
TCP发送/接收的缓存大小,以字节为单位
-c concurrency
Number of multiple requests to perform at a time. Default is one request at a time.
一次进行的请求数,默认是1
-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.
添加一个cookie,格式:name=value。 这个字段是重复的。
-d
Do not display the "percentage served within XX [ms] table". (legacy support).
不显示表格"percentage served within XX [ms] table", 支持旧版版本。
-e csv-file
Write a Comma separated value (CSV) file which contains for each percentage (from 1% to 100%) the time (in milliseconds) it took to serve that percentage of the requests. This is usually more useful than the 'gnuplot' file; as the results are already 'binned'.
写一个CSV逗号分隔值文件,文件里包含了它处理百分之多少的请求数所使用百分之多少的时间。它往往比gnuplot文件更有用。
-f protocol
Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL).
指定SSL/TLS协议(SSL2, SSL3, TLS1, 或 ALL)
-g gnuplot-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.
把所有可测量的值写到一个gnuplot或TSV(用制表符tab分隔的文件)文件. 这个文件能导入到gnuplot,IDL,Mathematica, Igor, 或者Excel包里。
-h
Display usage information.
显示帮助信息
-H custom-header
Append extra headers to the request. The argument is typically in the form of a valid header line, containing a colon-separated field-value pair (i.e. , "Accept-Encoding: zip/zop;8bit" ).
向请求中添加附加的头。 这个条件需要在一个有效的头里,用冒号隔开的一对值。如:"Accept-Encoding: zip/zop;8bit"
-i
Do HEAD requests instead of GET.
使用头请求代替GET。
-k
Enable the HTTP KeepAlive feature, i.e. , perform multiple requests within one HTTP session. Default is no KeepAlive.
启用HTTP KeepAlive功能,例如,一个HTTP session执行多个请求。 默认是 No KeepAlive.
-n requests
Number of requests to perform for the benchmarking session. The default is to just perform a single request which usually leads to non-representative benchmarking results.
基准测验会话时执行的请求数。 默认值是1,同时导致了没有任何代表含义的测试结果。
-p POST-file
File containing data to POST. Remember to also set -T.
POST包含数据的文件。同时需要设置 -T
-P proxy-auth-username :password
Supply BASIC Authentication credentials to a proxy en-route. The username and password are separated by a single : and sent on the wire base64 encoded. The string is sent regardless of whether the proxy needs it (i.e. , has sent an 407 proxy authentication needed).
支持BASIC代理验证。用户名和密码被冒号分开,base64算法加密后发送。
这个字符串不管代理是否需要。
-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 suppress these messages.
当处理150个请求以上时,ab根据stderr(标准错误)每10%或者100个请求就输出一个进度。-q能取消这些错误消息。
-r
Don't exit on socket receive errors.
socket接到错误时,不退出
-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.
当编译时,使用SSL保护的https而不是http协议。这个功能基本用于试验。正常情况下,不建议使用。
-S
Do not display the median and standard deviation values, nor display the warning/error messages when the average and median are more than one or two times the standard deviation apart. And default to the min/avg/max values. (legacy support).
不显示警告或错误信息
-t timelimit
Maximum number of seconds to spend for benchmarking. This implies a -n 50000 internally. Use this to benchmark the server within a fixed total amount of time. Per default there is no timelimit.
基本测试花费的最大的秒数。 一般为-n 5000。 使用这个命令来测试服务器。
-T content-type
Content-type header to use for POST/PUT data, eg. application/x-www-form-urlencoded . Default: text/plain .
用于POST/PUT数据 如:application/x-www.form-urlendoed. 默认是text/plain
-u PUT-file
File containing data to PUT. Remember to also set -T .
要PUT的文件。 同时需要设置-T
-v verbosity
Set verbosity level - 4 and above prints information on headers, 3 and above prints response codes (404, 200, etc.), 2 and above prints warnings and info.
设置冗余级别 -4 和以上,显示headers中的信息。3以上(404,200等),显示相应代码。 2以上,显示警告和信息。
-V
Display version number and exit.
显示版本号并退出。
-w
Print out results in HTML tables. Default table is two columns wide, with a white background.
打印结果到html表格。 默认表格有两列,背景为白色。
-x <table>-attributes
String to use as attributes for <table> . Attributes are inserted <table here >.
用作<table>属性的字符串。 属性插入到表格内部,如<table attributes>
-X proxy [:port ]
Use a proxy server for the requests.
使用代理服务器来请求
-y <tr>-attributes
String to use as attributes for <tr>.
用于<tr>属性的字符串
-z <td>-attributes
String to use as attributes for <td>.
用于<td>属性的字符串
-Z ciphersuite
Specify SSL/TLS cipher suite (See openssl ciphers).
指定SSL/TLS加密套接字
[1] Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一,在发送电子邮件时,服务器认证的用户名和密码需要用Base64编码,附件也需要用Base64编码。Base64要求把每三个8Bit的字节转换为四个6Bit的字节(3*8 = 4*6 = 24),然后把6Bit再添两位高位0,组成四个8Bit的字节,也就是说,转换后的字符串理论上将要比原来的长1/3。
Apache ab 工具
最新推荐文章于 2024-08-15 14:48:31 发布