ubuntu 14.04 LTS 安裝webbentch壓力測試工具

AilKennion 9年前發布 | 31K 次閱讀 測試工具

來自: http://blog.csdn.net//wgw335363240/article/details/39051433


   最近在做 壓力測試工具,除了apache的ab測試工具外,發現webbentch工具也不錯,這里簡單介紹下這兩個工具。


一、webbentch安裝:

    wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
    tar zxvf webbench-1.5.tar.gz
    cd webbench-1.5
    make && make install

如果沒有安裝ctags,則安裝的時候會報錯。ctags的安裝:

   apt-get install ctags

或者按照下面的步驟進行手動安裝:

   wget http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz
   tar zxvf ctags-5.8.tar.gz
   cd ctags-5.8
   ./configure
   make && make install


二、webbentch使用:

  測試原理:指定客戶端的并發數和執行時間,查看服務器發出的請求中susceed的個數和failed的個數

  使用命令:webbentch -c 10000 -t 60 http://xx.xx.xx.156:8082/index.html

  -c: 發起請求的客戶端數,也就是我們所說的并發數

  -t:執行時間長度

  執行結果如下:

  Webbench - Simple Web Benchmark 1.5

  Requests: 1033020 susceed, 5 failed.

  Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

  Benchmarking: GET http://10.103.13.156:8082/index.html
  10000 clients, running 60 sec.
                                                                                                
  Speed=1033025 pages/min, 3856600 bytes/sec.

  Requests: 1033020 susceed, 5 failed.


三、apache的ab使用:

  測試原理:指定客戶端的并發數和請求總量,計算服務器每秒可以處理的請求數和每個請求響應的時間

  使用命令:ab -c 10000 -n 80000 http://xx.xx.xx.156:8082/index.html

  -c : 發起請求的客戶端數,也就是我們所說的并發數

  -n:發起的總請求數

  執行結果如下:

   需要關心的幾個參數:Requests per second、Time per request

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 10.103.13.156 (be patient)
Completed 8000 requests
Completed 16000 requests
Completed 24000 requests
Completed 32000 requests
Completed 40000 requests
Completed 48000 requests
Completed 56000 requests
Completed 64000 requests
Completed 72000 requests
Completed 80000 requests
Finished 80000 requests


Server Software:        nginx                                             //web服務器
Server Hostname:        xx.xx.xx.156                             //web服務器地址
Server Port:            8082                                                //web服務器端口

Document Path:          /index.html                                //請求地址
Document Length:        2 bytes                                    //返回的數據長度

Concurrency Level:      10000                                      //設置的并發數,就是-c設置的值
Time taken for tests:   13.691 seconds                       //所有請求執行完成所耗費的時間
Complete requests:      80000                                      //完成的請求數
Failed requests:        0                                                    //失敗的請求數
Total transferred:      17920000 bytes                         //傳遞數據的大小,包括header的信息
HTML transferred:       160000 bytes                           //傳遞的html的大小,這里的數字等于   (Document Length)  *  (Complete requests)
Requests per second:    5843.27 [#/sec] (mean)      //美妙的請求數,也就是我們服務器可以承受的實際并發數,即通常所受的rps
Time per request:       1711.371 [ms] (mean)             //每個請求的響應時間,mean表示是平均值
Time per request:       0.171 [ms] (mean, across all concurrent requests)   //每個請求的時間,等于   (Time taken for tests * 1000ms) / Complete requests
Transfer rate:          1278.22 [Kbytes/sec] received    //每秒傳輸的數據量,可以計算是否是帶寬的影響

Connection Times (ms)                                                    //時間的統計
              min  mean[+/-sd] median   max
Connect:        2  156 486.3     18    4700
Processing:    12  240 920.8     19   12024
Waiting:       12  240 920.8     18   12024
Total:         29  396 1098.9     37   13050

Percentage of the requests served within a certain time (ms)
  50%     37                             //37毫秒響應了37%的請求
  66%     45                             //45毫秒響應了66%的請求
  75%    143                            //143毫秒響應了75%的請求,下面的以此類推
  80%    258
  90%   1035
  95%   3034
  98%   3702
  99%   6029
 100%  13050 (longest request)


三、注意事項:

   在使用webbentch和apache的ab進行壓力測試的時候,如果測試的url地址中有多個參數,需要對url中的"&"符號進行轉義,輸入“\&”即可;把"&"=>"%26"是沒有效果的。

如url為  http://xx.xx.xx.156:8080/info.php?p1=v1&p2=v2&p3=v3

轉換后   http://xx.xx.xx.156:8080/info.php?p1=v1\&p2=v2\&p3=v3

 

 本文由用戶 AilKennion 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!