<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > linux中給應用做壓力測試

          linux中給應用做壓力測試

          作者: 時間:2016-09-12 來源:網(wǎng)絡 收藏

          一.webbench

          本文引用地址:http://www.ex-cimer.com/article/201609/303426.htm

          在Ubuntu中安裝webbench —支持get,head等請求,但不支持post請求

          wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gztar zxvf webbench-1.5.tar.gzcd webbench-1.5make make install

          測試demo

          webbench -t 5 -c 2 http://google.com/ >2個并發(fā)用戶共同請求5秒

          測試結果分析

          Benchmarking: GET http://google.com/ #GET方法請求谷歌

          2 clients, running 5 sec. #2個用戶,運行5秒

          Speed=4296 pages/min, 38664 bytes/sec. #4296個頁面每秒,38664 bytes每秒

          Requests: 358 susceed, 0 failed. #358次請求成功,0次失敗

          二. ab

          在Ubuntu中安裝ab —支持 post ,get ,head 等方法

          sudo apt-get install apache2-util

          測試demo

          ab -n 500 -c 2 http://www.google.com/ >2個并發(fā)用戶共同請求個數(shù)500個。

          測試結果分析

          Server Software: gws #服務器信息

          Server Hostname: www.google.com #測試地址

          Server Port: 80 #測試端口

          Document Path: / #測試文檔路徑

          Document Length: 390 bytes #測試文檔大小

          Concurrency Level: 2 #并發(fā)數(shù)量

          Time taken for tests: 6.752 seconds #測試消耗時間

          Complete requests: 500 #完成的請求數(shù)

          Failed requests: 0 #失敗的請求數(shù)

          Non-2xx responses: 500 #HTTP響應數(shù)據(jù)的頭信息中含有2XX以外的狀態(tài)碼的請求數(shù)

          Total transferred: 566000 bytes #總傳輸數(shù)據(jù)大小HTML transferred: 195000 bytes #總傳輸html數(shù)據(jù)大小Requests per second: 74.05 [#/sec] (mean) #吞吐量,每秒處理平均請求數(shù)Time per request: 27.007 [ms] (mean) #每個請求平均等待時間Time per request: 13.504 [ms] (mean, across all concurrent requests) #服務器每個請求平均處理時間

          Transfer rate: 81.86 [Kbytes/sec] received #平均每秒流量數(shù)Connection Times (ms) #下面為時間花費的分布(連接、處理、等待、總數(shù))

          min mean[+/-sd] median max

          Connect: 1 1 0.2 1 2

          Processing: 22 26 7.6 25 150

          Waiting: 22 26 7.6 25 150

          Total: 23 27 7.6 26 151//下面為每個請求花費時間的分布Percentage of the requests served within a certain time (ms)50% 26 #50%在26毫秒之內(nèi)

          66% 27 #66%在27毫秒之內(nèi)

          75% 27

          80% 27

          90% 28 #主要看這個參數(shù),90%在28毫秒之內(nèi)

          95% 29

          98% 36

          99% 52

          100% 151 (longest request)

          如想在請求header加入數(shù)據(jù),如下:

          ab -H Cookie: key=value;key2=value2 ...

          4.利用ab 進行post請求

          ab -c 1 -n 100 -T 'application/json' -p data.json http://www.google.com/

          測試結果就不貼上來了,多了一個明顯的結果:

          Total body sent: 15900 #body總的發(fā)送量



          關鍵詞:

          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();