測試 Apache Web Server 效能測試指令 ab

測試 Apache Web Server 效能測試指令 ab

文章DarkSkyline » 週四 8月 16日, 2007年 10:17 am

說明:
有時候想要了解自己的 Web Server 的效能如何,這時候可以使用 Apache 內含的效能測試程式 - ab (Apache HTTP Server Benchmarking Tool)。

先來測試一下
# /usr/bin/ab -c 10 -n 1000 http://localhost/
-c 10:代表同時有 10 個連線
-n 1000:代表連續測試 1000 次

其它 ab 指令的用法:
Usage: /usr/bin/ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
-t timelimit Seconds to max. wait for responses
-p postfile File containing data to POST
-T content-type Content-type header for POSTing
-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.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-h Display usage information (this message)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)


This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests

# Aaache 的版本
Server Software: Apache/2.2.3
# 主機的位址
Server Hostname: localhost
# 主機的埠號
Server Port: 80

# 網頁的路徑
Document Path: /
# 網頁的大小
Document Length: 5044 bytes

# 同時的連線數
Concurrency Level: 10
# 所花費的時間
Time taken for tests: 1.979964 seconds
# 測試的次數
Complete requests: 1000
# 失敗的次數
Failed requests: 0
# 寫入失敗的次數
Write errors: 0
Non-2xx responses: 1000
# 總共傳輸的資料量
Total transferred: 5241000 bytes
# 總共傳輸的網頁資料量
HTML transferred: 5044000 bytes
# 每秒所能接受的連線請求
Requests per second: 505.06 [#/sec] (mean)
# 總共花費的時間
Time per request: 19.800 [ms] (mean)
# 單一連線測試所花費的時間
Time per request: 1.980 [ms] (mean, across all concurrent requests)
# 資料傳輸率
Transfer rate: 2584.90 [Kbytes/sec] received

# 測試的報表
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 4
Processing: 3 17 164.3 4 1976
Waiting: 3 16 164.3 3 1975
Total: 3 17 164.5 4 1978

# 每個階段所花費的時間單位(1/1000 秒)
Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 4
80% 4
90% 4
95% 4
98% 5
99% 21
100% 1978 (longest request)
http://www.ublink.org
Tel:04-22605121
E-Mail:eric@ublink.org
Skype:ublink-eric
LineID:0937720133
頭像
DarkSkyline
Site Admin
 
文章: 1860
註冊時間: 週五 12月 8日, 2006年 11:41 am
來自: 台中
送出感謝: 0 次
擁有感謝: 2

回到 Linux 作業系統

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 18 位訪客

cron