ab网站压力测试工具使用详解

来源:互联网 发布:天龙八部手游染色数据 编辑:程序博客网 时间:2024/05/16 15:27
使用方法:  ./ab [options] [http[s]://]hostname[:port]/path


选项:

    -n requests请求执行的请求数

    -c concurrency  多次请求的并发数

    -t timelimit    限时秒到最大值。花在基准测试

    -s timeout      超时秒到最大值。等待每个响应(默认值为30秒

    -b windowsize   TCP发送/接收缓冲区的大小,以字节为单位
    -B address      在进行传出连接时要绑定的地址
    -p postfile    包含要发布的数据的文件。记住也要设置 -T
    -u putfile      包含要放入的数据的文件。记住也要设置 -T
    -T content-type Content-type 用于POST / PUT数据的头。 'application/x-www-form-urlencoded' ,默认是 'text/plain'

    

    -v verbosity    需要多少故障排除信息来打印

    -w              在HTML表格中打印结果

    -i              使用 HEAD 而不是 GET


    -x attributes   作为表属性插入的字符串
    -y attributes   作为tr属性插入
    -z attributes   作为td或th属性插入
    -C attribute    添加cookie。Apache = 1234。(重复)
    -H attribute    添加任意标题行。'Accept-Encoding: gzip'插入所有正常的标题行。(重复)
    -A attribute  
添加基本的WWW认证,属性是一个冒号分隔的用户名和密码。
    -P attribute  
添加基本代理身份验证,属性是一个冒号分隔的用户名和密码。

    -X proxy:port   使用Proxyserver和端口号


    -V              打印版本号,退出
    -k              使用HTTP KeepAlive功能
    -d              不显示百分比表。
    -S              不显示置信估计者和警告。
    -q              当超过150个请求时,不显示进展

    -l               接受可变文档长度(用于动态页面)


    -g filename     输出收集到的数据到gnuplot格式文件。

    -e filename     输出CSV文件,有百分比服务


    -r              不要在socket上出现错误。
    -m method      
方法名称

    -h             显示使用信息(此消息)


    -Z ciphersuite  指定SSL / TLS密码套件(请参阅openssl加密程序)

    -f protocol     指定SSL / TLS协议 (SSL2, SSL3, TLS1, TLS1.1, TLS1.2 or ALL)



结果分析:
Server Software:        nginx //web服务器
Server Hostname:        127.0.0.1 //服务器主机名
Server Port:            80 //服务器端口

Document Path:          /index.php //请求的资源
Document Length:        34309 bytes // 文档返回的长度,不包括相应头

Concurrency Level:      100 // 并发个数
Time taken for tests:   292.241 seconds //总请求时间
Complete requests:      86 // 成功的请求数
Failed requests:        0 //失败的请求数
Write errors:           0
Total transferred:      2977836 bytes //网络传输量
HTML transferred:       2950574 bytes //HTML内容传输量
Requests per second:    0.29 [#/sec] (mean)// 平均每秒的请求数
Time per request:       339815.529 [ms] (mean) // 平均每个请求消耗的时间

Time per request:       3398.155 [ms] (mean, across all concurrent requests)
//每个请求实际运行时间的平均值
Transfer rate:          9.95 [Kbytes/sec] received // 时间传输速率

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   1.0      5       5
Processing:  2438 145776 83690.5 147778  287875
Waiting:     2426 145776 83690.8 147778  287875
Total:       2438 145780 83691.0 147782  287879
WARNING: The median and mean for the initial connection time are not within a normal deviation
        These results are probably not that reliable.

Percentage of the requests served within a certain time (ms)
  50%  147782 // 50%的请求都是在85ms内完成的
  66%  191107
  75%  217747
  80%  231139
  90%  261350
  95%  274685
  98%  284726
  99%  287879
 100%  287879 (longest request)

原创粉丝点击