webbench最多能夠模擬3萬個併發鏈接去測試網站的負載能力,我的感受要比Apache自帶的ab壓力測試工具好用,安裝使用也特別方便,而且很是小。php
主要是 -t 參數用着比較爽,下面參考了張宴的文章:html
一、適用系統:Linuxlinux
二、編譯安裝:web
[root@hexuweb102 ~]$wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
[root@hexuweb102 ~]$tar zxvf webbench-1.5.tar.gz
[root@hexuweb102 ~]$cd webbench-1.5
[root@hexuweb102 ~]$make && make install併發
三、使用:工具
[root@hexuweb102 webbench-1.5]$ webbench --help
webbench [option]... URL
-f|--force Don't wait for reply from server.
-r|--reload Send reload request - Pragma: no-cache.
-t|--time <sec> Run benchmark for <sec> seconds. Default 30.
-p|--proxy <server:port> Use proxy server for request.
-c|--clients <n> Run <n> HTTP clients at once. Default one.
-9|--http09 Use HTTP/0.9 style requests.
-1|--http10 Use HTTP/1.0 protocol.
-2|--http11 Use HTTP/1.1 protocol.
--get Use GET request method.
--head Use HEAD request method.
--options Use OPTIONS request method.
--trace Use TRACE request method.
-?|-h|--help This information.
-V|--version Display program version.
## 測試使用以下:
[root@hexuweb102 webbench-1.5]$ webbench -c 500 -t 30 http://127.0.0.1/phpinfo.php
</n></n></server:port></sec></sec>測試
參數說明:-c表示併發數,-t表示時間(秒)網站
四、測試結果示例:spa
[root@hexuweb102 webbench-1.5]$ webbench -c 200 -t 30 http://127.0.0.1/phpinfo.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.orm
Benchmarking: GET http://dev3.smarter.com.cn/index.php
200 clients, running 30 sec.
Speed=1294 pages/min, 3221114 bytes/sec.
Requests: 647 susceed, 0 failed.
舉個查看每分種處理多少pages的測試例子,計劃壓力測試2小時:
方法是使用Web Bench進行併發壓力測試,選擇的頁面是phpinfo.php,併發請求開始5個,每次循環增長5個進入下輪的循環,每一輪循環持續180s,到達最大200個併發時結束。這樣就能夠持續作2小時的測試。
[root@hexuweb102 webbench-1.5]$ for n in `seq 5 5 50` ; do echo -n $n " " ; webbench -c $n -t 60 http://127.0.0.1/phpinfo.php 2>/dev/null | grep Speed | awk '{print $1}' | awk -F= '{print $2}' ; echo ; done
# 能夠獲得下面數據:
clints Pages/Min
5 6824
10 6888
15 6849
20 6867
25 6892
30 6865
35 6846
40 6739
45 6699
50 6880
55 6831
60 6861
65 6847
70 6852
75 6818
80 6813
85 6858
90 6825
95 6840
100 6893
100 6871
105 6858
110 6890
115 6866
120 6893
125 6912
130 6857
135 6892
140 6874
145 6868
150 6891
155 6862
160 6893
165 6877
170 6872
175 6899
180 6855
185 6900
190 6882
195 6890
200 6904
五、其餘壓力測試工具及在線測試工具
Webbench、WAS、LoadRunner、WinRunner、WebLoad、ApacheBench、http_load、Siege
http://yali.webkaka.com/
引用 http://www.cnblogs.com/wangkangluo1/archive/2012/04/18/2455078.html