Linux下Web網站壓力測試工具Webbench

來源:互聯網
上載者:User

標籤:壓力測試   linux   網站 webbench   

webbench最多可以類比3萬個並發串連去測試網站的負載能力,個人感覺要比Apache內建的ab壓力測試工具好用,安裝使用也特別方便,並且非常小。


一,環境:linux

二,安裝方式:編譯安裝

 具體步驟如下:


 1,安裝編譯工具:

[[email protected] install]# yum install ctags wget make apr* autoconf automake gcc gcc-c++

 2,下載該軟體包

[[email protected] install]# wget http://home.tiscali.cz/cz210552/distfiles/webbench-1.5.tar.gz --2016-07-06 19:01:29--  http://home.tiscali.cz/cz210552/distfiles/webbench-1.5.tar.gzResolving home.tiscali.cz... 82.208.6.172Connecting to home.tiscali.cz|82.208.6.172|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 7675 (7.5K) [application/x-tar]Saving to: “webbench-1.5.tar.gz”100%[=====================================================================================>] 7,675       --.-K/s   in 0s      2016-07-06 19:01:36 (233 MB/s) - “webbench-1.5.tar.gz” saved [7675/7675]


 3,編譯安裝

[[email protected] install]# tar zxvf webbench-1.5.tar.gz webbench-1.5/webbench-1.5/webbench.1webbench-1.5/socket.cwebbench-1.5/webbench.cwebbench-1.5/Makefilewebbench-1.5/debian/webbench-1.5/debian/ruleswebbench-1.5/debian/dirswebbench-1.5/debian/copyrightwebbench-1.5/debian/controlwebbench-1.5/debian/changelogwebbench-1.5/COPYRIGHTwebbench-1.5/ChangeLog[[email protected] install]# cd webbench-1.5[[email protected] webbench-1.5]# mkdir /usr/local/man      #建立該目錄否則會失敗[[email protected] webbench-1.5]# makecc -Wall -ggdb -W -O   -c -o webbench.o webbench.cwebbench.c: In function ‘alarm_handler’:webbench.c:77: warning: unused parameter ‘signal’cc -Wall -ggdb -W -O  -o webbench webbench.o  ctags *.c[[email protected] webbench-1.5]# make installinstall -s webbench /usr/local/bininstall -m 644 webbench.1 /usr/local/man/man1install -d /usr/local/share/doc/webbenchinstall -m 644 debian/copyright /usr/local/share/doc/webbenchinstall -m 644 debian/changelog /usr/local/share/doc/webbench


 4,進行壓力測試

[[email protected] webbench-1.5]# webbench -c 100 -t 30 http://192.168.1.245/zabbix.php?action=dashboard.viewWebbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.Benchmarking: GET http://192.168.1.245/zabbix.php?action=dashboard.view100 clients, running 30 sec.Speed=1676 pages/min, 355898 bytes/sec.Requests: 838 susceed, 0 failed.

說明:-c 100:表示同時產生100個並發串連

   -t 30:表示持續30秒

備忘:webbench最大可以類比30000個並發串連


實戰:方法是使用Web Bench進行並發壓力測試,選擇的頁面是http://192.168.1.245/zabbix.php?action=dashboard.view並發請求開始5個,每次迴圈增加5個進入下輪的迴圈,每一輪迴圈持續180s,到達最大200個並發時結束。這樣就可以持續做2小時的測試。

for n in `seq 5 5 50` ; do echo -n $n " " ; webbench -c $n -t 60  http://192.168.1.245/zabbix.php?action=dashboard.view  1>/dev/null | grep Speed | awk ‘{print $1}‘ | awk -F= ‘{print $2}‘ ; echo ; done

[[email protected] webbench-1.5]# for n in `seq 5 5 50` ; do echo -n $n " " ; webbench -c $n -t 60  http://192.168.1.245/zabbix.php?action=dashboard.view  1>/dev/null | grep Speed | awk ‘{print $1}‘ | awk -F= ‘{print $2}‘ ; echo ; done5  Webbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.10  Webbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.15  Webbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.20  Webbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.25  Webbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.


本文出自 “清風明月” 部落格,請務必保留此出處http://liqingbiao.blog.51cto.com/3044896/1811622

Linux下Web網站壓力測試工具Webbench

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.