新聞中心

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

        linux中給應用做壓力測試

        作者: 時間:2016-09-12 來源:網絡 收藏

        一.webbench

        本文引用地址:http://www.104case.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個并發用戶共同請求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個并發用戶共同請求個數500個。

        測試結果分析

        Server Software: gws #服務器信息

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

        Server Port: 80 #測試端口

        Document Path: / #測試文檔路徑

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

        Concurrency Level: 2 #并發數量

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

        Complete requests: 500 #完成的請求數

        Failed requests: 0 #失敗的請求數

        Non-2xx responses: 500 #HTTP響應數據的頭信息中含有2XX以外的狀態碼的請求數

        Total transferred: 566000 bytes #總傳輸數據大小HTML transferred: 195000 bytes #總傳輸html數據大小Requests per second: 74.05 [#/sec] (mean) #吞吐量,每秒處理平均請求數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 #平均每秒流量數Connection Times (ms) #下面為時間花費的分布(連接、處理、等待、總數)

        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毫秒之內

        66% 27 #66%在27毫秒之內

        75% 27

        80% 27

        90% 28 #主要看這個參數,90%在28毫秒之內

        95% 29

        98% 36

        99% 52

        100% 151 (longest request)

        如想在請求header加入數據,如下:

        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總的發送量



        關鍵詞:

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 武宁县| 涟源市| 莱西市| 当雄县| 增城市| 阿鲁科尔沁旗| 迭部县| 乐安县| 合川市| 黄浦区| 曲麻莱县| 卢氏县| 迭部县| 黄平县| 开平市| 沂水县| 岱山县| 五寨县| 古交市| 卓尼县| 杂多县| 青州市| 林口县| 班玛县| 肥东县| 清水县| 镇平县| 吐鲁番市| 光山县| 临西县| 连平县| 呼图壁县| 涡阳县| 金堂县| 焉耆| 武宁县| 隆子县| 三河市| 阜宁县| 金门县| 塔河县|