centos 可以使用yum install siege -y (rpmforge仓库里)直接安装
Available Packages
Name : siege
Arch : i386
Version : 2.66
Release : 1.el5.rf
Size : 84 k
Repo : rpmforge
Summary : HTTP regression testing and benchmarking utility
URL : http://www.joedog.org/JoeDog/Siege/
License : GPL
Description: Siege is an http regression testing and benchmarking utility.
: It was designed to let web developers measure the performance of their code
: under duress, to see how it will stand up to load on the internet.
: Siege supports basic authentication, cookies, HTTP and HTTPS protocols.
: It allows the user hit a web server with a configurable number of concurrent
: simulated users. Those users place the webserver "under siege."
用法:先配置个配置文件,使用siege.config
[root@vps2 ~]# siege --help
****************************************************
siege: could not open /root/.siegerc
run 'siege.config' to generate a new .siegerc file
****************************************************
[root@vps2 ~]# siege.config
New configuration template added to /root/.siegerc
Run siege -C to view the current settings in that file
[root@vps2 ~]#
[root@vps2 ~]# siege -C
CURRENT SIEGE CONFIGURATION
JoeDog/1.00 [en] (X11; I; Siege 2.66)
Edit the resource file to change the settings.
----------------------------------------------
version: 2.66
verbose: true
debug: false
protocol: HTTP/1.1
connection: close
concurrent users: 15
time to run: n/a
repetitions: n/a
socket timeout: 30
delay: 1 sec
internet simulation: false
benchmark mode: false
failures until abort: 1024
named URL: none
URLs file: /usr/etc/urls.txt
logging: true
log file: /var/siege.log
resource file: /root/.siegerc
allow redirects: true
allow zero byte data: true
allow chunked encoding: true
proxy auth:
www auth:
[root@vps2 ~]# siege --help #帮助输出
SIEGE 2.66
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
[root@vps2 ~]#
其中
-c 并发
-r 重复次数
-f url列表文件
-b 没有延时
siege -c 200 -r 150 192.168.1.250 -b
[root@vps2 ~]# siege -c 5 -r 2 who.is -b
** SIEGE 2.66
** Preparing 5 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.23 secs: 2391 bytes ==> /
HTTP/1.1 200 0.23 secs: 2391 bytes ==> /
HTTP/1.1 200 0.24 secs: 2391 bytes ==> /
HTTP/1.1 200 0.50 secs: 2391 bytes ==> /
HTTP/1.1 200 0.50 secs: 2391 bytes ==> /
HTTP/1.1 200 0.32 secs: 2391 bytes ==> /
HTTP/1.1 200 0.33 secs: 2391 bytes ==> /
HTTP/1.1 200 0.22 secs: 2391 bytes ==> /
HTTP/1.1 200 0.48 secs: 2391 bytes ==> /
HTTP/1.1 200 0.23 secs: 2391 bytes ==> /
done. Transactions: 10 hits
Availability: 100.00 %
Elapsed time: 0.74 secs
Data transferred: 0.02 MB
Response time: 0.33 secs
Transaction rate: 13.51 trans/sec
Throughput: 0.03 MB/sec
Concurrency: 4.43
Successful transactions: 10
Failed transactions: 0
Longest transaction: 0.50
Shortest transaction: 0.22
FILE: /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.
[root@vps2 ~]#
可以看到日志输出在/var/siege.log,可以使用cat命令查看
[root@vps2 ~]# cat /var/siege.log
Date & Time, Trans, Elap Time, Data Trans, Resp Time, Trans Rate, Throughput, Concurrent, OKAY, Failed
2010-09-09 16:48:28, 200, 0.35, 0, 0.01, 571.43, 0.00, 7.29, 0, 0
2010-09-09 16:49:38, 10, 0.02, 0, 0.00, 500.00, 0.00, 1.50, 0, 0
2010-09-09 16:50:19, 10, 0.74, 0, 0.33, 13.51, 0.00, 4.43, 10, 0
[root@vps2 ~]#
vps
来源于:李海鑫个人博客
没有评论 :
发表评论