安装siege
下载
http://download.joedog.org/siege/siege-4.0.4.tar.gz
解压
sudo tar -zvxf siege-4.0.4.tar.gz -C /usr/local
编译安装
sudo ./configure
sudo make && sudo make install
使用
# siege -c 1000 -r 3 -f url.txt
Transactions: 765 hits
Availability: 100.00 %
Elapsed time: 11.14 secs
Data transferred: 0.21 MB
Response time: 2.05 secs
Transaction rate: 68.67 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 140.63
Successful transactions: 765
Failed transactions: 0
Longest transaction: 10.44
Shortest transaction: 0.07
修改配置
sudo vim ~/.siege/siege.conf
模拟POST提交参数
siege -c 1 -r 1 'http://xxx.com POST uid=1&content=test'
或者在url.txt中,
http://xxx.com POST uid=1&content=test
siege -c 1 -r 1 -f url.txt
-c, --concurrent=NUM 模拟有n个用户在同时访问,n不要设得太大,因为越大,siege消耗本地机器的资源越多
-r, --reps=NUM 重复运行测试n次,不能与-t同时存在
-t, --time=NUMm 持续运行siege ‘n’秒(如10S),分钟(10M),小时(10H)