使用apachebench并发请求测试服务器。ab一般位于apache/bin/下
举个栗子
ab -n 100 -c 10 http://xg.qq.com/
共发送100个请求,每笔并发10个。
可选参数:
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-username:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -Xproxy[:port] ] [ -y <tr>-attributes ] [ -z <td>-attributes ] [http://]hostname[:port]/path
参数说明:
-A auth-username:password
:
隔开,并以base64编码形式发送。 无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。
-c concurrency
-C cookie-name=value
Cookie:
行。 其典型形式是name=value
的一个参数对。 此参数可以重复。
-d
-e csv-file
-g gnuplot-file
-h
-H custom-header
"Accept-Encoding: zip/zop;8bit"
).
-i
HEAD
请求,而不是GET
。
-k
-n requests
-p POST-file
-P proxy-auth-username:password
:
隔开,并以base64编码形式发送。 无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。
-q
ab
每处理大约10%或者100个请求时,会在stderr
输出一个进度计数。 此-q
标记可以抑制这些信息。
-s
ab -h
会显示相关信息)使用了SSL的受保护的https
, 而不是http
协议的时候。此功能是实验性的,也是很简陋的。最好不要用。
-S
-t timelimit
-n 50000
。 它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。
-T content-type
-v verbosity
4
或更大值会显示头信息, 3
或更大值可以显示响应代码(404, 200等), 2
或更大值可以显示警告和其他信息。
-V
-w
-x <table>-attributes
<table>
属性的字符串。 此属性被填入<table 这里 >
.
-X proxy[:port]
-y <tr>-attributes
<tr>
属性的字符串.
-z <td>-attributes
<td>
属性的字符串.
参考:http://coolnull.com/2240.html
结果说明: