Windows 7環境下網站性能測試小工具 Apache Bench 和 Webbench使用和下載

1簡要說明

Apache Bench Apache的網站性能測試小程序,Windows平臺下的程序名簡稱ab.exe,要想獲得這個80k的可執行程序,用戶需要下載整個Apache Httpd軟件包!還需要將其安裝到電腦上,確實比較麻煩。

Webbench也是一款網站性能測試小程序,可以獲得網站的吞吐率、傳送速度等基本性能指標。該程序是在Linux下編程的,在Linux下編譯安裝使用都很方便,但在Windows 下的程序卻沒有。

爲了方便起見,我將ab.exe 小程序單獨拷貝出來,並且下載了webbench的源碼,使用CodeBlocks程序和Cygwin64,將源碼編譯了一下,生成Windows7 環境下可執行的文件webbench.exe ,方便在一個平臺下同時使用2個程序,進行網站性能測試。

 

2、下載地址

Windows7 64位下的兩個網站性能測試小工具下載地址:

鏈接:https://pan.baidu.com/s/1hDhBlNc4ss_sp-qPYk_kEQ

提取碼:upas

 

3、運行截圖:

01-Windows7 64位下webbench測試結果

 01-Windows7 64位下webbench測試結果.jpg

02-Apache Bench 性能測試小工具-運行參數

 02-apache bench 性能測試小工具-運行參數.jpg

03-Apache Bench 性能測試小工具-測試結果1

 03-apache bench 性能測試小工具-測試結果1.jpg

04-Apache Bench 性能測試小工具-測試結果2

 04-apache bench 性能測試小工具-測試結果2.jpg

 

4、測試命令及結果分析

ab.exe -n 15000 -c 100 http://www.abc.com/

# -n 15000總共發送的1.5萬個訪問請求N

# -c 100模擬100個用戶同時訪問C個;

# 結果分析:

#   Concurrency Level:  模擬併發用戶數(命令行中輸入的數據)C

#   Time taken for tests: 完成整個測試的時間T

#   Requests per second: 服務器性能(在當前併發下每秒能處理的請求數)=N/T

#   Time per request: (mean)從用戶的角度計算,每個請求平均花費時間=T/N/C
#       解釋:每個用戶發送N/C個請求,共花費T秒,每個請求平均花費時間=T/N/C

#   Time per request:(mean, across all concurrent requests)從服務器角度計算,完成每個請求的平均花費時間=T/N

#   Transfer rate: 傳送速率

 

webbench.exe -c 100 -t 5 http://www.abc.com/

# -c 100模擬100個用戶同時訪問;

# -t 5 持續5秒鐘測試時間

# 需要測試的網址 http://www.abc.com/ ,注意只測網站名時,結尾要加/

#

# Speed pages/min 每分鐘多少個請求, Speed pages/sec 每秒鐘多少個請求

# bytes/sec  傳送速率

# Requests: 總共完成的請求數

 

5、注意事項

!!!不要對公共網址發送大量訪問請求!!!可用於自己的網站上線前的性能測試。

 

6、使用幫助

C:\>ab --help

ab: wrong number of arguments

Usage: ab [options] [http://]hostname[:port]/path

Options are:

    -n requests     Number of requests to perform

    -c concurrency  Number of multiple requests to make at a time

    -t timelimit    Seconds to max. to spend on benchmarking

                    This implies -n 50000

    -s timeout      Seconds to max. wait for each response

                    Default is 30 seconds

    -b windowsize   Size of TCP send/receive buffer, in bytes

    -B address      Address to bind to when making outgoing connections

    -p postfile     File containing data to POST. Remember also to set -T

    -u putfile      File containing data to PUT. Remember also to set -T

    -T content-type Content-type header to use for POST/PUT data, eg.

                    'application/x-www-form-urlencoded'

                    Default is 'text/plain'

    -v verbosity    How much troubleshooting info to print

    -w              Print out results in HTML tables

    -i              Use HEAD instead of GET

    -x attributes   String to insert as table attributes

    -y attributes   String to insert as tr attributes

    -z attributes   String to insert as td or th attributes

    -C attribute    Add cookie, eg. 'Apache=1234'. (repeatable)

    -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'

                    Inserted after all normal header lines. (repeatable)

    -A attribute    Add Basic WWW Authentication, the attributes

                    are a colon separated username and password.

    -P attribute    Add Basic Proxy Authentication, the attributes

                    are a colon separated username and password.

    -X proxy:port   Proxyserver and port number to use

    -V              Print version number and exit

    -k              Use HTTP KeepAlive feature

    -d              Do not show percentiles served table.

    -S              Do not show confidence estimators and warnings.

    -q              Do not show progress when doing more than 150 requests

    -l              Accept variable document length (use this for dynamic pages)

 

    -g filename     Output collected data to gnuplot format file.

    -e filename     Output CSV file with percentages served

    -r              Don't exit on socket receive errors.

    -m method       Method name

    -h              Display usage information (this message)

 

C:\>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.

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章