siege压力测试工具

1、siege
一款开源的压力测试工具,可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请

求过程的相应时间,并在一定数量的并发访问下重复进行。

Siege是一个压力测试和评测工具,设计用于WEB开发这评估应用在压力下的承受能力:可以根据配置

对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发

访问下重复进行。 

安装
[root@localhost www]# tar -zxvf siege-2.55.tar.gz
[root@localhost www]# cd siege-2.55
[root@localhost siege-2.55]# ./configure --prefix=/usr/local/siege

使用
使用
siege -c 200 -r 10 -f example.url
-c是并发量,-r是重复次数。 url文件就是一个文本,每行都是一个url,它会从里面随机访问的。

---------
siege包含了一组压力测试工具:
SIEGE (1) Siege是一个HTTP压力测试和评测工具.
使用样例: 
任务列表:www.chedong.com.url文件
http://www.chedong.com/tech/
http://www.chedong.com/tech/acdsee.html
http://www.chedong.com/tech/ant.html
http://www.chedong.com/tech/apache_install.html
http://www.chedong.com/tech/awstats.html
http://www.chedong.com/tech/cache.html
http://www.chedong.com/tech/click.html
http://www.chedong.com/tech/cms.html
http://www.chedong.com/tech/compress.html
http://www.chedong.com/tech/cvs_card.html
http://www.chedong.com/tech/default.html
http://www.chedong.com/tech/dev.html
http://www.chedong.com/tech/gnu.html
....

siege -c 20 -r 2 -f www.chedong.com.url
参数说明: 
-c 20 并发20个用户 
-r 2 重复循环2次 
-f www.chedong.com.url 任务列表:URL列表

 

参数:
-c:指定并发的用户个数  如:-c 200

-r:指定重复的次数      如:-r 300

-d:指定延迟时间        如:-d 5

-f:指定URL列表         如:-f /tmp/xxx.list

-i: 随机 URL ,默认是从列表的上面到下面来打压力

-b: 进行压力测试,不进行延时

-t: 持续时间,即测试持续时间,在NUM时间后结束,单位默认为分
---------
结果说明
Lifting the server siege… done.
Transactions: 3419263 hits //完成419263次处理
Availability: 100.00 % //100.00 % 成功率
Elapsed time: 5999.69 secs //总共用时
Data transferred: 84273.91 MB //共数据传输84273.91 MB
Response time: 0.37 secs //相应用时1.65秒:显示网络连接的速度
Transaction rate: 569.91 trans/sec //均每秒完成 569.91 次处理:表示服务器后台处理的速度
Throughput: 14.05 MB/sec //平均每秒传送数据
Concurrency: 213.42 //实际最高并发数
Successful transactions: 2564081 //成功处理次数
Failed transactions: 11 //失败处理次数
Longest transaction: 29.04 //每次传输所花最长时间
Shortest transaction: 0.00 //每次传输所花最短时间

./siege -c 200 -r 300 -f abc.txt -b -i -t 1h
---------
输出样例: 

** 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显示的是测试机器和被

测试服务器之间网络链接状况。Transaction rate则表示服务器端任务处理的完成速度。 

辅助工具: 
增量压力测试: 

为了方便增量压力测试,siege还包含了一些辅助工具:
bombardment (1) 
是一个辅助工具:用于按照增量用户压力测试: 
使用样例: 
bombardment urlfile.txt 5 3 4 1
初始化URL列表:urlfile.txt
初始化为:5个用户 
每次增加:3个用户 
运行:4次 
每个客户端之间的延迟为:1秒 

输出成CSV格式: 
siege2csv.pl (1) 
siege2csv.pl将bombardment的输出变成CSV格式: 
Time Data Transferred Response Time Transaction Rate Throughput Concurrency Code 200 

(note that this is horribly broken.) 
242 60.22 603064 0.02 4.02 10014.35 0.08
605 59.98 1507660 0.01 10.09 25136.05 0.12
938 59.98 2337496 0.02 15.64 38971.26 0.26
1157 60 2883244 0.04 19.28 48054.07 0.78
--

Siege测试指标部分描述:

Transactions:                 已完成的事务总数

Availability:                 完成的成功率

Elapsed time:                 总共使用的时间

Data transferred:             响应中数据的总大小

Response time:                显示网略连接的速度

Transaction rate:             平均每秒完成的事务数

Throughput:                   平均每秒传送的数据量

Concurrency:                  实际最高并发连接数

Successful transactions:      成功处理的次数

Failed transactions:          失败处理的次数

Longest transaction:          最长事务处理的时间

Shortest transaction:         最短事务处理时间

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章