日期:2014-05-17  浏览次数:21031 次

apache自带压力测试工具ab的使用

AB(ApacheBench) Apache 自带的超文本传输协议 (HTTP) 性能测试工具。 其 设计意图是描绘当前所安装的 Apache 的执行性能, 主要是显示 Apache 每秒可以处理多少个请求。

?

?? 该工具是 Apache 自带的工具。 安装 了 Apache Http Server 就有了 ap 程序。 ? Apache Server 可以从 Apache 官网直接下载:

?

http://httpd.apache.org/download.cgi#apache22

?

安装完后,在 apache Bin 目录下有 ab.exe 程序。 这个就是 我们的 AB 工具。

?

AB 工具的使用方法:

?

C: >cd C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin

C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin>ab

ab: wrong number of arguments

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

Options are:

??? -n requests???? Number of requests to perform

??? -c concurrency? Number of multiple requests to make

??? -t timelimit??? Seconds to max. wait for responses

??? -b windowsize?? Size of TCP send/receive buffer, in bytes

??? -p postfile???? File containing data to POST. Remember also to set -T

??? -u putfile????? File containing data to PUT. Remember also to set -T