[精讚] [會員登入]

測試web server效能

linux 有個好用且免費的指令ab可以測試web server 的能力

分享完整連結 //n.sfs.tw/m10363

分享連結 測試web server效能@精讚
(文章歡迎轉載,請尊重版權註明連結來源)
2017-09-04 12:38:56 By 張○○
# ab -c 200 -t 60  http://xxx.tc.edu.tw/

    -c 是同時的連線數
    -t 是最久測試時間,超過此時間,程式就停止,預設無限制。
    網址後面的 '/' 不要漏掉

結果範例

 

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 n.sfs.tw (be patient)
Finished 267 requests


Server Software:        Apache/2.4.6
Server Hostname:        n.sfs.tw
Server Port:            80

Document Path:          /
Document Length:        16991 bytes <==抓取頁面的大小,不含其中的圖片或檔案

Concurrency Level:      200
Time taken for tests:   60.418 seconds
Complete requests:      267
Failed requests:        243
   (Connect: 0, Length: 243, Exceptions: 0)
Write errors:           0
Non-2xx responses:      1
Total transferred:      4644866 bytes
HTML transferred:       4543811 bytes
Requests per second:    4.45 [#/sec] (mean)
Time per request:       44944.137 [ms] (mean)
Time per request:       224.721 [ms] (mean, across all concurrent requests)
Transfer rate:          75.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   1.3      4       7
Processing:  2011 29057 9931.3  31716   39795
Waiting:     2006 29050 9931.0  31706   39789
Total:       2014 29060 9931.4  31720   39800

Percentage of the requests served within a certain time (ms)
  50%  31717   <== 完成50%的req.所花的時間ms
  66%  34341
  75%  35163
  80%  36678
  90%  37824
  95%  38295
  98%  39084
  99%  39415   <== 完成99%的req.所花的時間ms
 100%  39800 (longest request)   <== 最後一筆完成所花的時間ms,也就是最多費時

判斷參考

1. 如果數據都很平均,如上面 50% 31717~39415 99% 類似這樣,表示伺服器在這個服務量時很充裕。

2. 前面很平均,例如~95%,但後面98%, 99%, 100%時暴高,甚至是95%就暴高,那表示伺服器無法應付後來的請求,負載已達上限。

3. 有些服務會在爆大量時回應500或403錯誤訊息而不是不回應,會造成檢測結果失真,事實上使用者無法知道能不能成功取得頁面。

4. 平均數值偏大時有可能是網路的問題,請試著在離峰時或本機進行測試。

5. 某些防火牆會對大量的請求進行封鎖並視為攻擊,在測試時應多多注意。

參考資料

[1] http://ns2.ublink.org/phpbb/viewtopic.php?t=1475&sid=8d3a48665f3a9ff7f3136ff8784053d1

[2] http://forum.icst.org.tw/phpbb/viewtopic.php?f=20&t=14658&start=0&st=0&sk=t&sd=a

END
你可能有興趣

[Rocky9] 安裝node.js 18, node.js 20

原本的nodejs16在使用 quasar dev時出現錯誤,得升級成18版以上

[SSL] Could not read certificate from server.cer 的錯誤排除

在轉換ssl憑證時,出現無法讀取的錯誤,可是怎麼看憑證都很正常,該怎麼解決?

[Linux] 如何能知道我是什麼時候安裝系統的?

linux想知道什麼時候裝系統的? 不必憑記憶。

地圖填色的網站

我們想為國家填色不需要小畫家,這個網站能幫助你

[Linux] 列出所有目錄及所占空間的方法

想知道目錄下的所有目錄所占的空間大小?

[Linux] grep 排除特定字串

使用 -v 參數可以讓grep排除特定字串的方法