壓力測試

由 Derek 發表於 七月 3, 2011 / 尚無評論

壓力測試
# /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)

 

關於作者

一個半路殺出來的傻小子,憑著一股傻勁努力的學習、嘗試、分享。希望能用自己微薄之力,替IT界和資訊界盡一點心力。單憑一己之力始終還是有限,歡迎和我有相同理念的夥伴一同加入一同努力。

評論

此文章尚無評論。

發表評論

*