天天看点

siege性能测试

压测工具:

简介:

siege官网地址http://www.joedog.org/

安装:

wget http://download.joedog.org/siege/siege-3.0.8.tar.gz

tar xzvf siege-3.0.8.tar.gz

cd siege-3.0.8

./configure

make && make install

[root@zhuiqiuqiji www]# find /  -name 'siege'

/home/yeqing/siege-3.0.8/src/siege

/usr/local/bin/siege

/usr/local/bin/siege -h

准备测试url 或者url列表文件

压测:

  20个用户(每次并发量,注意不是每秒并发量) 重复10次 共产生 20 * 10 = 200个请求  如下:

案例1:

[root@zhuiqiuqiji www]# /home/yeqing/siege-3.0.8/src/siege php ./test.php -b -c20 -r10 

** SIEGE 3.0.8

** Preparing 20 concurrent users for battle.

The server is now under siege...

done.

Transactions:                0 hits

Availability:                0.00 %

Elapsed time:                0.13 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:            200

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.

说明:-c是并发量,-r是重复次数。url_list.txt就是一个文本文件,每行都是一个url,它会从里面随机访问的。

案例2:

cat url_list.txt

  curl -d 'name=ye&age=18' www.demo.com/test.php

  curl -d 'name=yeqing&age=18' www.demo.com/test.php

[root@zhuiqiuqiji www]# /usr/local/bin/siege -b -c20 -r10  -f url_list.txt

Transactions:                   0 hits

Availability:                0.00 %         成功率

Elapsed time:                1.99 secs      总共使用时间

Data transferred:            0.00 MB        共传输数据0MB

Response time:                0.00 secs      响应时间,显示网络连接的速度

Transaction rate:            0.00 trans/sec 平均每秒完成 0 次处理

Throughput:                0.00 MB/sec    平均每秒传送数据

Concurrency:                0.00           实际最高并发连接数

Successful transactions:           0          成功处理次数

Failed transactions:             200           失败处理次数

Longest transaction:            0.00        每次传输所花最长时间

Shortest transaction:            0.00        每次传输所花最短时间

案例3:

  /usr/local/bin/siege -b -c100 -r10  dig www.baidu.com

Lifting the server siege...      done.

Transactions:                 152 hits

Availability:               96.82 %

Elapsed time:              159.40 secs

Data transferred:            4.09 MB

Response time:                4.12 secs

Transaction rate:            0.95 trans/sec

Throughput:                0.03 MB/sec

Concurrency:                3.93

Successful transactions:         152

Failed transactions:               5

Longest transaction:           17.93

Shortest transaction:            0.12

本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1870680