siege一个不错开源软件。
1、官方网站:http://www.joedog.org/JoeDog/Siege
2、下载地址:ftp://ftp.joedog.org/pub/siege/siege-2.65.tar.gz
3、安装方法:
tar zxvf siege-2.65.tar.gz
cd siege-2.65
./configure
make
make install
4、参数说明:
siege 2.65
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 //并发用户数量,缺省为10
-u, --url="URL" Deprecated. Set URL as the last argument. //要做压力测试的url
-i, --internet INTERNET user simulation, hits the URLs randomly. //模拟internet用户随机访问url
-b, --benchmark BENCHMARK, signifies no delay for time testing. //hit没有时间间隔
-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 //压力测试的次数缺省为25
-f, --file=FILE FILE, change the configuration file to file. //测试的url列表文件
-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
siege -c 10 -r 2 "http://www.sina.com.cn" //10个并发做两次测试
siege -c 10 -t 1m "http://www.sina.com.cn" //10个并发持续一分钟
siege -c 10 -t 1m -i -f urllist.txt //10个并发持续一分钟,模拟internat方式访问,urllist.txt内容为所有要做测试的url
5、测试结果:
Lifting the server siege... done.
Transactions: 1090 hits
Availability: 100.00 %
Elapsed time: 59.72 secs
Data transferred: 57.00 MB
Response time: 0.06 secs
Transaction rate: 18.25 trans/sec
Throughput: 0.95 MB/sec
Concurrency: 1.00
Successful transactions: 1090
Failed transactions: 0
Longest transaction: 3.03
Shortest transaction: 0.00