centos6 ab性能測試web服務器
安裝ab
yum -y install httpd-tools
-c 100 表示並發用戶數為100
-n 100 表示請求總數為100
ab -c 100 -n 100 http://127.0.0.1/index.php
Server Software: nginx/1.10.2 #平臺nginx 版本1.10.2
Server Hostname: 127.0.0.1 #服務器主機名
Server Port: 80 #服務器端口
Document Path: /index.php #測試的頁面文檔
Document Length: 307 bytes #文檔大小
Concurrency Level: 100 #並發數
Time taken for tests: 9.764 seconds #整個測試持續的時間
Complete requests: 100 #完成的請求數量
Failed requests: 0 #失敗的請求數量
Write errors: 0
Non-2xx responses: 100
Total transferred: 51300 bytes #整個場景中的網絡傳輸量
HTML transferred: 30700 bytes #整個場景中的HTML內容傳輸量
Requests per second: 10.24 [#/sec] (mean) #吞吐率,在100個並發用戶數下單位時間內處理的請求數。每秒10.24次 mean 表示平均值。值越大越好
Time per request: 9764.459 [ms] (mean) #用戶平均請求等待時間, mean 表示平均值
Time per request: 90.303 [ms] (mean, across all concurrent requests) #每個請求實際運行時間的平均值
Transfer rate:
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 4 1.3 4 6
Processing: 11 1784 2708.6 95 9018
Waiting: 5 1784 2708.7 95 9018
Total: 11 1788 2709.3 99 9022
Percentage of the requests served within a certain time (ms)
50% 99 #50%的用戶響應時間小於99毫秒
66% 1269 #66%的用戶響應時間小於1269 毫秒
75% 3275 #75%的用戶響應時間小於3275 毫秒
80% 4275
90% 6762
95% 8012
98% 8763
99% 9022
100% 9022 (longest request) #最大的響應時間小於7785 毫秒
#並發請求cpu並不是同時處理的,而是按照每個請求獲得的時間片逐個輪轉處理的,所以基本上第一個Time per request時間約等於第二個Time per request時間乘以並發請求數。
本文出自 “Shell” 博客,請務必保留此出處http://zhizhimao.blog.51cto.com/3379994/1940080
centos6 ab性能測試web服務器