最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Apache ab并發(fā)負載壓力測試實現(xiàn)方法

 更新時間:2019年09月27日 13:20:47   作者:龜仙人  
Apache的ab命令模擬多線程并發(fā)請求,測試服務器負載壓力,也可以測試nginx、lighthttp、IIS等其它Web服務器的壓力

ab命令原理

Apache的ab命令模擬多線程并發(fā)請求,測試服務器負載壓力,也可以測試nginx、lighthttp、IIS等其它Web服務器的壓力。
ab命令對發(fā)出負載的計算機要求很低,既不會占用很多CPU,也不會占用太多的內(nèi)存,但卻會給目標服務器造成巨大的負載,因此是某些DDOS攻擊之必備良藥,老少皆宜。自己使用也須謹慎。否則一次上太多的負載,造成目標服務器直接因內(nèi)存耗光死機,而不得不硬重啟,得不償失。

在帶寬不足的情況下,最好是本機進行測試,建議使用內(nèi)網(wǎng)的另一臺或者多臺服務器通過內(nèi)網(wǎng)進行測試,這樣得出的數(shù)據(jù),準確度會高很多。遠程對web服務器進行壓力測試,往往效果不理想(因為網(wǎng)絡延時過大或帶寬不足)

下載安裝:
http://mirror.bit.edu.cn/apache//httpd/binaries/win32/?C=M;O=A

找到 httpd-2.2.21-win32-x86-no_ssl.msi

參數(shù)文檔:
http://httpd.apache.org/docs/2.2/programs/ab.html

運行:

在Windows系統(tǒng)下,打開cmd命令行窗口,定位到apache安裝目錄的bin目錄下
cd C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin

鍵入命令:

 ab -n 800 -c 800 http://192.168.0.10/

(-n發(fā)出800個請求,-c模擬800并發(fā),相當800人同時訪問,后面是測試url)

ab -t 60 -c 100 http://192.168.0.10/
在60秒內(nèi)發(fā)請求,一次100個請求。

//如果需要在url中帶參數(shù),這樣做
ab -t 60 -c 100 -T "text/plain" -p p.txt http://192.168.0.10/hello.html

p.txt 是和ab.exe在一個目錄
p.txt 中可以寫參數(shù),如 p=wdp&fq=78

結果參數(shù)解釋:
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.0.10 (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
Finished 800 requests


Server Software:        Microsoft-HTTPAPI/2.0
Server Hostname:        192.168.0.10
Server Port:            80

Document Path:          /
Document Length:        315 bytes       HTTP響應數(shù)據(jù)的正文長度

Concurrency Level:      800
Time taken for tests:   0.914 seconds    所有這些請求處理完成所花費的時間
Complete requests:      800             完成請求數(shù)
Failed requests:        0                失敗請求數(shù)
Write errors:           0               
Non-2xx responses:      800
Total transferred:      393600 bytes     網(wǎng)絡總傳輸量
HTML transferred:       252000 bytes     HTML內(nèi)容傳輸量
Requests per second:    875.22 [#/sec] (mean) 吞吐量-每秒請求數(shù)
Time per request:       914.052 [ms] (mean)  服務器收到請求,響應頁面要花費的時間
Time per request:       1.143 [ms] (mean, across all concurrent requests) 并發(fā)的每個請求平均消耗時間
Transfer rate:          420.52 [Kbytes/sec] received 平均每秒網(wǎng)絡上的流量,可以幫助排除是否存在網(wǎng)絡流量過大導致響應時間延長的問題


網(wǎng)絡上消耗的時間的分解:
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.5      1       3
Processing:   245  534 125.2    570     682
Waiting:       11  386 189.1    409     669
Total:        246  535 125.0    571     684

整個場景中所有請求的響應情況。在場景中每個請求都有一個響應時間
其中 50% 的用戶響應時間小于 571 毫秒
80 % 的用戶響應時間小于 652 毫秒
最大的響應時間小于 684 毫秒
Percentage of the requests served within a certain time (ms)
  50%    571
  66%    627
  75%    646
  80%    652
  90%    666
  95%    677
  98%    681
  99%    682
100%    684 (longest request)

相關文章

最新評論

安庆市| 任丘市| 广丰县| 响水县| 尖扎县| 辽中县| 新营市| 曲阳县| 淮安市| 上饶县| 利津县| 光山县| 永兴县| 济源市| 封丘县| 广丰县| 濮阳市| 丹阳市| 五原县| 双江| 瑞安市| 凤阳县| 天台县| 临江市| 板桥市| 房山区| 手游| 岗巴县| 云梦县| 凌海市| 松江区| 家居| 乃东县| 漳浦县| 金秀| 绥中县| 额敏县| 辽阳县| 茂名市| 土默特右旗| 扬州市|