转自http://www.cnblogs.com/PursuitOnly/archive/2013/02/07/2908591.html
先看看ab总的流程图有个总体印象。
第二步ab简介
采用 apache 版本为:apache-‐2.2.22
使用:
在 ubuntu 系统下:
./ab -n 1000 -c 50 -p post.txt http://127.0.0.1:9090/query 发送 1000 个请求,每次发 50 个,post 的内容在 post.txt 里。
提要:
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
注:红色部分是不可缺少部分。
还可以修改源码添加需要的option。比如添加-D参数输出结果
比如在终端输入命令: ./ab –D 2 -n 1000 -c 100 -p postdata.txt 10.200.34.41/
第三步: ab源码分析
转载于:https://blog.51cto.com/12085896/1855359