ab壓力測(cè)試工具

1 我們可以模擬100個(gè)并發(fā)用戶,對(duì)一個(gè)頁(yè)面發(fā)送1000個(gè)請(qǐng)求

./ab -n1000 -c100 https://www.baidu.com/

其中-n代表請(qǐng)求數(shù),-c代表并發(fā)數(shù)
ab常用參數(shù)的介紹:
-n :總共的請(qǐng)求執(zhí)行數(shù),缺省是1;

-c: 并發(fā)數(shù),缺省是1;

-t:測(cè)試所進(jìn)行的總時(shí)間,秒為單位,缺省50000s

-p:POST時(shí)的數(shù)據(jù)文件

-w: 以HTML表的格式輸出結(jié)果
執(zhí)行測(cè)試用例:ab -n 1000 -c 100 -w http://localhost/index.php >>1.html
上面的測(cè)試用例表示100并發(fā)的情況下,共測(cè)試訪問(wèn)index.php腳本1000次,并將測(cè)試結(jié)果保存到1.html文件中。

返回結(jié)果:

首先是apache的版本信息

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 vm1.jianfeng.com (be patient)

Server Software: Apache/2.2.19 ##apache版本
Server Hostname: vm1.jianfeng.com ##請(qǐng)求的機(jī)子
Server Port: 80 ##請(qǐng)求端口

Document Path: /a.html
Document Length: 25 bytes ##頁(yè)面長(zhǎng)度

Concurrency Level: 100 ##并發(fā)數(shù)
Time taken for tests: 0.273 seconds ##共使用了多少時(shí)間
Complete requests: 1000 ##請(qǐng)求數(shù)
Failed requests: 0 ##失敗請(qǐng)求
Write errors: 0
Total transferred: 275000 bytes ##總共傳輸字節(jié)數(shù),包含http的頭信息等
HTML transferred: 25000 bytes ##html字節(jié)數(shù),實(shí)際的頁(yè)面?zhèn)鬟f字節(jié)數(shù)
Requests per second: 3661.60 [#/sec] (mean) ##每秒多少請(qǐng)求,這個(gè)是非常重要的參數(shù)數(shù)值,服務(wù)器的吞吐量
Time per request: 27.310 [ms] (mean) ##用戶平均請(qǐng)求等待時(shí)間
Time per request: 0.273 [ms] (mean, across all concurrent requests) ##服務(wù)器平均處理時(shí)間,也就是服務(wù)器吞吐量的倒數(shù)
Transfer rate: 983.34 [Kbytes/sec] received ##每秒獲取的數(shù)據(jù)長(zhǎng)度

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 2.3 0 16
Processing: 6 25 3.2 25 32
Waiting: 5 24 3.2 25 32
Total: 6 25 4.0 25 48

Percentage of the requests served within a certain time (ms)
50% 25 ## 50%的請(qǐng)求在25ms內(nèi)返回
66% 26 ## 60%的請(qǐng)求在26ms內(nèi)返回
75% 26
80% 26
90% 27
95% 31
98% 38
99% 43
100% 48 (longest request)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,616評(píng)論 19 139
  • 原文:https://www.fanhaobai.com/2016/02/ab.html ab(ApacheBen...
    Howborn閱讀 959評(píng)論 0 1
  • 1、附帶cookie 先構(gòu)建個(gè)“已登錄”的會(huì)話,把標(biāo)識(shí)這個(gè)會(huì)話的Cookie值(Session ID)記下來(lái)。如果...
    zshanjun閱讀 549評(píng)論 0 0
  • 當(dāng)你使用PHP(或其他編程語(yǔ)言)完成一個(gè)web程序的開(kāi)發(fā),并且web程序在Apache服務(wù)器上正常運(yùn)行的時(shí)候,你有...
    零一間閱讀 19,942評(píng)論 0 14
  • 寫(xiě)在前面 在學(xué)習(xí)ab工具之前,我們需了解幾個(gè)關(guān)于壓力測(cè)試的概念 吞吐率(Requests per second)概...
    橙子醬閱讀 241,745評(píng)論 13 190

友情鏈接更多精彩內(nèi)容