AB壓力測試工具

1.安裝AB工具:html

yum install httpd-tools

2.測試:nginx

ab -n 100 -c 10 http://localhost.com/

其中-n表示請求數,-c表示併發數web

3.測試結果apache

[root@vijay01 ~]# ab -c 10 -n 1000 http://192.168.2.11/ab.html
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 192.168.2.11 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.0.15
Server Hostname:        192.168.2.11
Server Port:            80

Document Path:          /ab.html
Document Length:        3698 bytes

Concurrency Level:      10
Time taken for tests:   0.105 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3910000 bytes
HTML transferred:       3698000 bytes
Requests per second:    9515.20 [#/sec] (mean)
Time per request:       1.051 [ms] (mean)
Time per request:       0.105 [ms] (mean, across all concurrent requests)
Transfer rate:          36332.46 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       2
Processing:     0    1   0.5      1       3
Waiting:        0    1   0.4      1       2
Total:          0    1   0.5      1       5

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      2
  95%      2
  98%      2
  99%      3
 100%      5 (longest request)

--------------------------------------------------------------------------------------------------------------------服務器

Server Software:        nginx/1.0.15
Server Hostname:        192.168.2.11
Server Port:            80
  • 這段展現的是web服務器的信息,能夠看到服務器採用的是nginx,域名是wan.bigertech.com,端口是80
Document Path:          /ab.html
Document Length:        3698 bytes
  • 這段是關於請求的文檔的相關信息,所在位置「/」,文檔的大小爲338436 bytes(此爲http響應的正文長度)

------------------------------------------------------------------------------------------------------------------網絡

Concurrency Level:      10
Time taken for tests:   0.105 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3910000 bytes
HTML transferred:       3698000 bytes
Requests per second:    9515.20 [#/sec] (mean)
Time per request:       1.051 [ms] (mean)
Time per request:       0.105 [ms] (mean, across all concurrent requests)
Transfer rate:          36332.46 [Kbytes/sec] received
  • 這段展現了壓力測試的幾個重要指標

  Concurrency Level: 100           --併發請求數
  Time taken for tests: 50.872 seconds   --整個測試持續的時間
  Complete requests: 1000          --完成的請求數
  Failed requests: 0                 --失敗的請求數併發

  Total transferred: 13701482 bytes      --整個場景中的網絡傳輸量
  HTML transferred: 13197000 bytes     --整個場景中的HTML內容傳輸量工具

Requests per second: 19.66 [#/sec] (mean)     --吞吐率,你們最關心的指標之一,至關於 LR 中的每秒事務數,後面括號中的 mean 表示這是一個平均值
Time per request: 5087.180 [ms] (mean)          --用戶平均請求等待時間,你們最關心的指標之二,至關於 LR 中的平均事務響應時間,後面括號中的 mean 表示這是一個平均值
Time per request: 50.872 [ms] (mean, across all concurrent requests)    --服務器平均請求處理時間,你們最關心的指標之三
測試

Transfer rate: 263.02 [Kbytes/sec] received             --平均每秒網絡上的流量,能夠幫助排除是否存在網絡流量過大致使響應時間延長的問題spa

-----------------------------------------------------------------------------------------------------

Connection Times (ms) min  mean[+/-sd] median   max
Connect:               0    0   0.2      0       2
Processing:         0    1   0.5      1       3
Waiting:            0    1   0.4      1       2
Total:              0    1   0.5      1       5
  • 這段表示網絡上消耗的時間的分解

------------------------------------------------------------------------------------------------------

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      2
  95%      2
  98%      2
  99%      3
 100%      5 (longest request)

  

  • 這段是每一個請求處理時間的分佈狀況,50%的處理時間在4930ms內,66%的處理時間在5008ms內...,重要的是看90%的處理時間。
相關文章
相關標籤/搜索