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

來源:互聯網
上載者:User

標籤:壓力測試   ab測試   並發   webbentch   

   最近在做 壓力測試工具,除了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

 

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.