siege的安装和使用
1 、siege的安装
安装nodejs
sudo npm install gitbook -g
下载安装包
wget http://download.joedog.org/siege/siege-4.0.4.tar.gz
解压
tar zxvf siege-4.0.4.tar.gz
打开解压包
cd siege-4.0.4
执行
./configure
看到如下图

执行
make
执行
make install
执行 siege -h
[root@VM_0_15_centos siege-4.0.4]# siege -h
[alert] Zip encoding disabled; siege requires zlib support to enable it
SIEGE 4.0.4
Usage: siege [options]
siege [options] URL
siege -g URL
Options:
-V, --version VERSION, prints the version number.
-h, --help HELP, prints this section.
-C, --config CONFIGURATION, show the current config.
-v, --verbose VERBOSE, prints notification to screen.
2 、siege的使用
siege是性能测试工具,是命令行模式的。
主要的参数有
-c NUM, --concurrent=NUM
This option allows you to set the concurrent number of users. The total number of users is technically limited to your computer's resources.
指的是并发用户的数
-t NUMm, --time=NUMm
This option is similar to --reps but instead of specifying the number of times each user should run, it specifies the amount of time each should run. The value format is "NUMm", where "NUM" is an amount of time and the "m" modifier is either S, M, or H for seconds, minutes and hours.
指的是时间
-r 指运行的次数
-l 指输出日志
- 具体查看,可以使用 man siege,回车后命令并没有结束。
可以输入/ 再输入想要搜索的单词,按enter,再按n表示搜索下一个。
举例:siege -c 20 -r 3 -l siege.log http://ur.tencent.com
表示20个用户,运行3遍,log记录到siege.log里面。
得到:
Transactions: 1254 hits
Availability: 99.52 %
Elapsed time: 16.10 secs
Data transferred: 37.46 MB
Response time: 0.24 secs
Transaction rate: 77.89 trans/sec
Throughput: 2.33 MB/sec
Concurrency: 18.32
Successful transactions: 1254
Failed transactions: 6
Longest transaction: 3.50
Shortest transaction: 0.04
Transactions: 事务数 1254 hits
Availability: 可用率 99.52 %
Elapsed time: 消耗的时间 16.10 secs
Data transferred: 传输多少数据 37.46 MB
Response time: 响应时间 0.24 secs
Transaction rate: tps 77.89 trans/sec
Throughput: 吞吐率 2.33 MB/sec
Concurrency: 平均的并发请求数 18.32
Successful transactions: 成功的请求 1254
Failed transactions: 失败的请求 6
Longest transaction: 最长的请求 3.50
Shortest transaction: 最短的请求 0.04
里面的关系有:
Response time乘以 Transactions除以 Elapsed time = Concurrency
- (未完待续)