siege 工具安装过程
yum install gcc
http://www.joedog.org/index/siege-manual
wget ftp://ftp.joedog.org/pub/siege/siege-latest.tar.gz
tar -vxzf siege-latest.tar.gz
cd siege-2.69/
./configure
make
make install
vi /etc/hosts
127.0.0.1 localhost
192.168.100.38 dev.google.com
ping dev.google.com
mkdir /usr/local/var/
cat /usr/local/var/siege.log
siege -d1 -c200 -r100 http://dev.google.com/producttags/A/
siege -d1 -c200 -r100 -f /root/abc.txt
******Putty 连接参数******
host name:192.168.146.129
port:22
connetion type:ssh
load sessions:192.168.146.129
close window on exit: only on clean exit
login: root
password: 2010
-----------------------------------------------------------测试环境
CPU:intel 四核
Memory:4G
Network=1Gbs
Hard Disk=10000转/分钟
OP=CentOS Linux
WinSCP
putty.exe
Siege
------------------------------------------------------------ Siege Help
[root@localhost var]# siege --help
SIEGE 2.69
Usage: siege [options]
siege [options] URL
siege -g URL
Options:
-V, --version VERSION, prints version number to screen.
-h, --help HELP, prints this section.
-C, --config CONFIGURATION, show the current configuration.
-v, --verbose VERBOSE, prints notification to screen.
-g, --get GET, pull down headers from the server and display HTTP
transaction. Great for web application debugging.
-c, --concurrent=NUM CONCURRENT users, default is 10
-u, --url="URL" Deprecated. Set URL as the last argument.
-i, --internet INTERNET user simulation, hits the URLs randomly.
-b, --benchmark BENCHMARK, signifies no delay for time testing.
-t, --time=NUMm TIME based testing where "m" is the modifier S, M, or H
no space between NUM and "m", ex: --time=1H, one hour test.
-r, --reps=NUM REPS, number of times to run the test, default is 25
-f, --file=FILE FILE, change the configuration file to file.
-R, --rc=FILE RC, change the siegerc file to file. Overrides
the SIEGERC environmental variable.
-l, --log LOG, logs the transaction to PREFIX/var/siege.log
-m, --mark="text" MARK, mark the log file with a string separator.
-d, --delay=NUM Time DELAY, random delay between 1 and num designed
to simulate human activity. Default value is 3
-H, --header="text" Add a header to request (can be many)
-A, --user-agent="text" Sets User-Agent in request
------------------------------------------------------------Test Result
Lifting the server siege... done.
Transactions: 0 hits
Availability: 0.00 %
Elapsed time: 15.36 secs
Data transferred: 0.00 MB
Response time: 0.00 secs
Transaction rate: 0.00 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.00
Successful transactions: 0
Failed transactions: 0
Longest transaction: 0.00
Shortest transaction: 0.00
FILE: /usr/local/var/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.
------------------------------------------------------------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,模拟用户对网站访问的随机性)
==== 选项如下: ==== 在屏幕上打印显示出当前的配置,配置是包括在他的配置文件$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 Example: siege -c 100 -t30M -u http://telltruth.net/
关于作者:
freebsd:
==== .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 设定有多少用户并发访问 持续"siege"多长时间,可以秒,分钟,小时为单位 设定默认的urls.txt文件位置,使用此选项须确保""url = xxx""无效(注释掉即可) url = http://xxx.xxx.xxx 只针对某个url进行测试,此选项会使urls.txt的设定无效(-f URLSFILE) 此外,siege还支持很多其他的功能,可以通过proxy测试,也可以测试需要用户身份认证的网页 使用样例: siege -c 20 -r 2 -f www.chedong.com.url 输出样例: ** Siege 2.59 注意:由于速度很快,可能会达不到并发速度很高就已经完成。Response time显示的是测试机器和被测试服务器之间网络链接状况。Transaction rate则表示服务器端任务处理的完成速度。 辅助工具:
输出成CSV格式: |