Apache 的ab測試php
操做:html
windows + r cmd 進入命令行模式 找到 apache 下的 ab.exe;算法
而後 在bin 目錄下 進行操做apache
ab -n1000 -c100 http://www.test.com/test.phpwindows
返回以下結果:服務器
Server Software: Apache/2.0.54網絡
//平臺apache 版本2.0.54併發
Server Hostname: 127.0.0.1測試
//服務器主機名命令行
Server Port: 80
//服務器端口
Document Path: /index.html.zh-cn.gb2312
//測試的頁面文檔
Document Length: 1018 bytes
//文檔大小
Concurrency Level: 1000
//併發數
Time taken for tests: 8.188731 seconds
//整個測試持續的時間
Complete requests: 1000
//完成的請求數量
Failed requests: 0
//失敗的請求數量
Write errors: 0
Total transferred: 1361581 bytes
//整個場景中的網絡傳輸量
HTML transferred: 1055666 bytes
//整個場景中的HTML內容傳輸量
Requests per second: 122.12 [#/sec] (mean)
//你們最關心的指標之一,至關於 LR 中的 每秒事務數 ,後面括號中的 mean 表示這是一個平均值
Time per request: 8188.731 [ms] (mean)
//你們最關心的指標之二,至關於 LR 中的 平均事務響應時間 ,後面括號中的 mean 表示這是一個平均值
Time per request: 8.189 [ms] (mean, across all concurrent requests)
//每一個請求實際運行時間的平均值
Transfer rate: 162.30 [Kbytes/sec] received
//平均每秒網絡上的流量,能夠幫助排除是否存在網絡流量過大致使響應時間延長的問題
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 646 1078.7 89 3291
Processing: 165 992 493.1 938 4712
Waiting: 118 934 480.6 882 4554
Total: 813 1638 1338.9 1093 7785
//網絡上消耗的時間的分解,各項數據的具體算法還不是很清楚
Percentage of the requests served within a certain time (ms)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (longest request)
//整個場景中全部請求的響應狀況。在場景中每一個請求都有一個響應時間,其中50%的用戶響應時間小於1093 毫秒,60% 的用戶響應時間小於1247 毫秒,最大的響應時間小於7785 毫秒
因爲對於併發請求,cpu實際上並非同時處理的,而是按照每一個請求得到的時間片逐個輪轉處理的,因此基本上第一個Time per request時間約等於第二個Time per request時間乘以併發請求數