Linux ab 命令
生活随笔
收集整理的這篇文章主要介紹了
Linux ab 命令
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
ab 是一個(gè)性能測(cè)試工具,用來(lái)測(cè)試一個(gè)頁(yè)面每秒鐘能處理多少HTTP請(qǐng)求
[root@localhost ~]$ yum install -y httpd-tools # 安裝ab工具 [root@localhost ~]$ ab -c 10 -n 1000 http://www.91cnm.com/ # 指定并發(fā)請(qǐng)求數(shù)為10,總請(qǐng)求數(shù)為1000,對(duì)http://www.91.cnm.com/進(jìn)行壓力測(cè)試 This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking www.91cnm.com (be patient) Completed 100 requests # 已經(jīng)完成了100個(gè)請(qǐng)求 Completed 200 requests # 已經(jīng)完成了200個(gè)請(qǐng)求 Completed 300 requests Completed 400 requests # 這個(gè)地方是關(guān)注點(diǎn)之一,如果全部完成了,說(shuō)明服務(wù)器能扛住我們所指定的請(qǐng)求量 Completed 500 requests # 我們可以繼續(xù)增大請(qǐng)求數(shù)來(lái)進(jìn)行測(cè)試,直到扛不住了就是最大的所能處理的請(qǐng)求了 Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: nginx # 所請(qǐng)求的服務(wù)端軟件 Server Hostname: www.91cnm.com # 所請(qǐng)求的服務(wù)端主機(jī)名 Server Port: 80 # 所請(qǐng)求的服務(wù)端端口 Document Path: / # 請(qǐng)求的URL資源 Document Length: 10507 bytes # 請(qǐng)求的頁(yè)面大小 Concurrency Level: 10 # 并發(fā)請(qǐng)求數(shù),也就是我們用 -c 10 指定的數(shù)量 Time taken for tests: 43.339 seconds # 總訪問(wèn)時(shí)間,也就是服務(wù)器處理完這些請(qǐng)求所花費(fèi)的時(shí)間 Complete requests: 1000 # 請(qǐng)求成功的數(shù)量 Failed requests: 0 # 請(qǐng)求失敗的數(shù)量,這個(gè)地方也是關(guān)注點(diǎn)之一,如果出現(xiàn)有失敗的,說(shuō)明有點(diǎn)扛不住了 Write errors: 0 # 網(wǎng)絡(luò)連接寫入錯(cuò)誤數(shù) Total transferred: 10645000 bytes # 請(qǐng)求的總數(shù)據(jù)大小(包括header頭信息) HTML transferred: 10507000 bytes # 請(qǐng)求的HTML文檔的總數(shù)據(jù)大小 Requests per second: 23.07 [#/sec] (mean) # 平均每秒請(qǐng)求數(shù),是總請(qǐng)求數(shù)除以處理完成這些請(qǐng)求數(shù)所花費(fèi)的時(shí)間的結(jié)果,也是重要指標(biāo)之一 Time per request: 433.387 [ms] (mean) # 表示用戶平均請(qǐng)求等待時(shí)間,參考:https://www.imooc.com/article/19952 Time per request: 43.339 [ms] (mean, across all concurrent requests) # 表示服務(wù)器平均請(qǐng)求處理時(shí)間,參考:https://www.imooc.com/article/19952 Transfer rate: 239.87 [Kbytes/sec] received # 平均每秒傳輸多少K,也就是服務(wù)器的帶寬了 Connection Times (ms)min mean[+/-sd] median max Connect: 150 164 32.4 168 1163 Processing: 150 265 307.8 168 2726 Waiting: 150 264 307.9 168 2726 Total: 300 429 311.4 336 2895Percentage of the requests served within a certain time (ms)50% 336 # 50%的請(qǐng)求數(shù)在336ms內(nèi)返回66% 338 # 66%的請(qǐng)求數(shù)在338ms內(nèi)返回75% 340 80% 341 # 這個(gè)地方也是關(guān)注點(diǎn)之一,我們不僅要扛住這么多請(qǐng)求,而且要盡快地處理請(qǐng)求并響應(yīng)回客戶端90% 697 95% 1073 98% 1766 99% 1843 100% 2895 (longest request)?
?
?
?
?
?
? ??
轉(zhuǎn)載于:https://www.cnblogs.com/pzk7788/p/10143474.html
總結(jié)
以上是生活随笔為你收集整理的Linux ab 命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 存储过程——介绍(一)
- 下一篇: Linux最终将会领先于Windows、