Web性能壓力測試之Webbench使用詳解


Webbench是知名的網站壓力測試工具,它是由Lionbridge公司(http://www.lionbridge.com)開發。
Webbench能測試處在相同硬件上,不同服務的性能以及不同硬件上同一個服務的運行狀況。webbench的標准測試可以向我們展示服務器的兩項內容:每秒鍾相應請求數和每秒鍾傳輸數據量。webbench不但能具有便准靜態頁面的測試能力,還能對動態頁面(ASP,PHP,JAVA,CGI)進 行測試的能力。還有就是他支持對含有SSL的安全網站例如電子商務網站進行靜態或動態的性能測試。
Webbench最多可以模擬3萬個並發連接去測試網站的負載能力。
官方主頁:http://home.tiscali.cz/~cz210552/webbench.html
官方介紹:
Web Bench is very simple tool for benchmarking WWW or proxy servers. Uses fork() for simulating multiple clients and can use HTTP/0.9-HTTP/1.1 requests. This benchmark is not very realistic, but it can test if your HTTPD can realy handle that many clients at once (try to run some CGIs) without taking your machine down. Displays pages/min and bytes/sec. Can be used in more aggressive mode with -f switch.

1、WebBench安裝
# yum install -y gcc ctags
# wget http://www.ha97.com/code/webbench-1.5.tar.gz
# tar zxvf webbench-1.5.tar.gz
# cd webbench-1.5
# make
# make install

2、WebBench使用
webbench -c 1000 -t 60 http://test.domain.com/phpinfo.php
webbench -c 並發數 -t 運行測試時間 URL

3、測試實例結果
當並發300時:
向http://test.domain.com/phpinfo.php發起300個線程請求,持續時間60秒
# webbench -c 300 -t 60 http://test.domain.com/phpinfo.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://test.domain.com/phpinfo.php
300 clients, running 60 sec.

Speed=24525 pages/min, 20794612 bytes/sec.
Requests: 24525 susceed, 0 failed.
速度:每秒鍾響應請求數:24525 pages/min,每秒鍾傳輸數據量20794612 bytes/sec.
返回數:24525次返回成功,0次返回失敗

當並發1000時:
# webbench -c 1000 -t 60 http://test.domain.com/phpinfo.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://test.domain.com/phpinfo.php
1000 clients, running 60 sec.

Speed=24920 pages/min, 21037312 bytes/sec.
Requests: 24833 susceed, 87 failed.

當並發1000時,已經顯示有87個連接failed了,說明超負荷了。

備注:
1、壓力測試工作應該放到產品上線之前進行
2、測試時盡量跨公網模擬正式環境進行
3、測試時並發應當由小逐漸加大,比如並發100時觀察一下網站負載是多少、打開是否流程,並發200時又是多少、網站打開緩慢時並發是多少、網站打不開時並發又是多少

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM