`
samuschen
  • 浏览: 399291 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论
阅读更多
Siege -- 压力测试工具

 

Siege 是一个多线程的WEB性能测试工具,被设计成可以让WEB开发人员了解代码在长时间压力下的性能.可以模拟很多用户同时访问WEB服务器,此数量可以自由定义.这就相当于web server被围攻(siege )了.

性能指标包括已用时间(elapsed time),总数据传输量(total data transferred),服务器响应时间 (response time),执行率?(transaction rate),并发数(concurrency),每次运行后会生成报告.

siege 有三种运行模式:regression,internet simulation,brute force(我们最常用的是internet simulation,模拟用户对网站访问的随机性)

==== 选项如下: ====
''-C,或--config''

在屏幕上打印显示出当前的配置,配置是包括在他的配置文件$HOME/.siegerc中,可以编辑里面的参数,这样每次siege 都会按照它运行.

''-v''

运行时能看到详细的运行信息

''-c n,或--concurrent=n''

模拟有n个用户在同时访问,n不要设得太大,因为越大,siege 消耗本地机器的资源越多

''-i,--internet''

随机访问urls.txt中的url列表项,以此模拟真实的访问情况(随机性),当urls.txt存在是有效

''-d n,--delay=n''

hit每个url之间的延迟,在0-n之间

-r n,--reps=n

重复运行测试n次,不能与 -t同时存在

-t n,--time=n

持续运行siege 'n'秒(如10S),分钟(10M),小时(10H)

-l

运行结束,将统计数据保存到日志文件中siege .log,一般位于/usr/local/var/siege .log中,也可在.siegerc中自定义

-R SIEGERC,--rc=SIEGERC

指定用特定的siege 配置文件来运行,默认的为$HOME/.siegerc

-f FILE, --file=FILE

指定用特定的urls文件运行siege ,默认为urls.txt,位于siege 安装目录下的etc/urls.txt

-u URL,--url=URL

测试指定的一个URL,对它进行"siege ",此选项会忽略有关urls文件的设定

urls.txt文件:

是很多行待测试URL的列表以换行符断开,格式为:

[protocol://]host.domain.com[:port][path/to/file]

例如:

http://www.telltruth.net/wiki/index.php
http://www.telltruth.net/index.html
http://www.telltruth.net/gallery
www.telltruth.net/blog

Example:

siege -c 100 -t30M -u http://telltruth.net/


表示对http://telltruth.net/ 这个站点使用100个用户并发访问,持续30分钟进行测试
注意:"-t30M"之间没有空格

关于作者:
siege 的作者:Jeffrey Fulmer <jeff@joedog.org >
官方主页:joedog.org


==== 安装 ====

freebsd:
<code>
pkg_add -r siege
</code>
或者使用ports:
<code>
cd /usr/ports/benchmarks/siege
make
make install
</code>
gentoo:
<code>
emerge siege
</code>

==== .siegerc中几个重要的选项 ====

internet = true | false

true表示对urls.txt中的URL随机访问,以模拟实际的Internet;false表示按urls.txt中的URL列表顺序访问

logging = true|false

选择是否记录结果到日志中

logfile = /home/maxim/log/siege .log

运行结果日志的保存位置

protocol = HTTP/1.0 | HTTP/1.1

选择协议的类型

concurrent = 80

设定有多少用户并发访问
time = n(S|M|H)

持续"siege "多长时间,可以秒,分钟,小时为单位
file = /path/to/urls.txt

设定默认的urls.txt文件位置,使用此选项须确保""url = xxx""无效(注释掉即可)

url = http://xxx.xxx.xxx

只针对某个url进行测试,此选项会使urls.txt的设定无效(-f URLSFILE)

此外,siege 还支持很多其他的功能,可以通过proxy测试,也可以测试需要用户身份认证的网页

使用样例:
任务列表: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列表

输出样例:

** 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则表示服务器端任务处理的完成速度。

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


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

输出成CSV格式:
siege 2csv.pl (1)
siege 2csv.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压力测试windows版

    siege -c 200 -r 10 -f example.url -c是并发量,-r是重复次数。 url文件就是一个文本,每行都是一个url,它会从里面随机访问的。 example.url内容: http://www.licess.cn http://www.vpser.net ...

    siege-3.1.2.tar.gz

    Siege 一款开源的压力测试工具,可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。 官方:http://www.joedog.org/ Siege下载:...

    siege2.72最新版本以及使用教程

    Siege是一个多线程的WEB性能测试工具,被设计成可以让WEB开发人员了解代码在长时间压力下的性能.可以模拟很多用户同时访问WEB服务器,此数量可以自由定义.这就相当于web server被围攻(siege)了. 性能指标包括已用时间...

    siege-windows.rar

    siege压力测试windows版

    X Hero Siege 3.16[CN]技能加强版

    魔兽地图X Hero Siege 3.16[CN]技能加强版

    siege-4.1.1.tar.gz

    siege-4.1.1.tar.gz

    siege-4.0.4测试工具.zip

    siege-4.0.4 Siege是一款高性能的Http压力测试工具。 Siege支持身份验证、cookies、http、https和ftp协议。

    siege3.0压测工具及脚本示例.zip

    siege3.0 windows版,实测可用。 ./siege -c 100 -t 1S http://localhost:9501 ./siege -c 100 -t 1M http://localhost:9501 ./siege -c 100 -t 1S -f urls.txt ./siege --debug -c 10 -t 1S ...

    siege-windows-3.0.5 压力测试

    Siege是一款开源的压力测试工具,设计用于评估WEB应用在压力下的承受能力

    siege-3.1.4.tar.gz

    siege (压力测试和评测工具),Siege是一个压力测试和评测工具,用于WEB开发。

    siege-windows-3.0.5.0

    windows版siege并发测试工具,便捷,快速测试服务器性能及接口响应速度。

    siege-2.67.tar.gz

    Siege 是一个回归测试和基准测试的程序. 它旨在让开发人员在压力下测试性能, 了解系统的承受能力。 Siege 支持 HTTP、HTTPS 协议。 Siege 可以配置一定数量的客户端并发访问服务器。

    siege-3.0.2.tar.gz压力测试工具

    siege-3.0.2.tar.gz压力测试工具,个人感觉是目前比较好用的linux下压力测试工具。

    The siege in Peking, China against the world

    The siege in Peking, China against the world

    siege 安装包

    siege 最新版安装包,实践过,很好使用,在linux上安装。

    siege使用指南

    siege的常见使用

    siege————网络压力测试工具

    siege的安装 unzip filename.zip cd siege-*.*.* ./configure --prefix=/usr/local/siege --mandir=/usr/local/man --with-ssl=/usr/local/ssl mkdir -p /usr/local/siege/etc mkdir -p /usr/local/siege/var ...

    cs_siege_cz(cs_siege的改版)

    请覆盖安装到CS安装目录的cstrike目录下。

    siege 使用说明

    siege 是软件压力测试小工具,主要介绍工具和使用方法。

    siege-latest.tar.gz

    linux下压力测试工具,还不错,认真读读配置文件,只需要改etc/urls.txt就ok了

Global site tag (gtag.js) - Google Analytics