壓測工具:
簡介:
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