web压力测试软件有不少,此次教你们三个 ab(apache),siege(可测试总体网站),webbench(测试高并发)php
一.ab
安装就很少介绍了,安装apache就会安装的html
# ab -c 100 -n 10000 http://127.0.0.1/index.php
表示同时处理100个请求并运行10000次web
二.siegeapache
# wget ftp://sid.joedog.org/pub/siege/siege-latest.tar.gz # ./configure # make # make install
创建网站列表服务器
# vi www.domain.com.url ############################# http://127.0.0.1/01.html http://127.0.0.1/02.html http://127.0.0.1/03.html http://127.0.0.1/04.html http://127.0.0.1/05.html #############################
测试并发网络
# siege -c 20 -r 2 -f www.domain.com.url
参数说明:
-c 20 并发20个用户
-r 2 重复循环2次
-f www.domain.com.url 任务列表:URL列表并发
输出样例:dom
** Siege 2.59 ** Preparing 20 concurrent users for battle. 此次“战斗”准备了20个并发用户 The server is now under siege.. done. 服务在“围攻”测试中: Transactions: 40 hits 完成40次处理 Availability: 100.00 % 成功率 Elapsed time: 7.67 secs 总共用时 Data transferred: 877340 bytes 共数据传输:877340字节 Response time: 1.65 secs 相应用时1.65秒:显示网络链接的速度 Transaction rate: 5.22 trans/sec 平均每秒完成5.22次处理:表示服务器后台处理的速度 Throughput: 114385.92 bytes/sec 平均每秒传送数据:114385.92字节 Concurrency: 8.59 最高并发数 8.59 Successful transactions: 40 成功处理次数 Failed transactions: 0 失败处理次数
注意:因为速度很快,可能会达不到并发速度很高就已经完成。Response time显示的是测试机器和被测ide
试服务器之间网络连接情况。Transaction rate则表示服务器端任务处理的完成速度。高并发
三.webbench
# tar zxvf webbench-1.5.tar.gz # cd webbench-1.5 # make && make install
压力测试
# webbench -c 500 -t 30 http://127.0.0.1/test.jpg
参数说明:-c表示并发数,-t表示时间(秒)
webbench有一点好处,就是能够测试高达 3万的并发数
参考
http://www.chedong.com/blog/archives/000033.html
http://blog.s135.com/read.php/288.htm