使用ApacheBench进行网站性能测试

来源:互联网 发布:淘宝图片ps处理教程 编辑:程序博客网 时间:2024/05/16 15:34

         ApacheBench 主要是用来测试阿帕奇服务器执行效率用的。安装好apache服务器套件后,进入bin目录,就可以找到该可执行文件ab.exe。

         ApacheBench可以针对某一特定URL模拟出连续的联机请求,同时还可以仿真出同时间点个数相同的联机请求,因而利用 ApacheBench 可帮助我们在网站开发期间仿真实际上线可能的情况,利用仿真出来的数据做为调整服务器设定或程序的依据。

ab用法如下

Usage: ab [options] [http[s]://]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
    -p postfile     File containing data to POST
    -T content-type Content-type header for POSTing
    -v verbosity    How much troubleshooting info to print
    -w              Print out results in HTML tables
    -i              Use HEAD 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)
    -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.
    -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
    -s              Use httpS instead of HTTP (SSL)
    -h              Display usage information (this message)

 

原创粉丝点击