ab壓力測試

ab的安裝apache

1.源碼安裝apache服務器

apache安裝完畢後ab命令存放在apache安裝目錄的bin目錄下。併發

2.yum安裝apache工具

若是apache 是經過yum的RPM包方式安裝的話,ab命令默認存放在/usr/bin目錄下spa

3.沒有安裝apache直接安裝ab.net

若是不想安裝apache可是又想使用ab命令的話,咱們能夠直接安裝apache的工具包httpd-toolstoken

yum -y install httpd-tools源碼

 

ab的使用requests

-c 表示 併發用戶數it

-n表示 總請求數

[root@cobbler bin]# ab -c3 -n30 https://10.207.200.100/main/index/index
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 10.207.200.100 (be patient).....done


Server Software:        Apache/2.2.15
Server Hostname:        10.207.200.100
Server Port:            443
SSL/TLS Protocol:       TLSv1/SSLv3,ECDHE-RSA-AES256-GCM-SHA384,2048,256

Document Path:          /main/index/index
Document Length:        295 bytes

Concurrency Level:      3
Time taken for tests:   0.232 seconds
Complete requests:      30
Failed requests:        0
Write errors:           0
Non-2xx responses:      30
Total transferred:      14250 bytes
HTML transferred:       8850 bytes

Requests per second:    129.59 [#/sec] (mean)
Time per request:       23.150 [ms] (mean)
Time per request:       7.717 [ms] (mean, across all concurrent requests)
Transfer rate:          60.11 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       12   19   7.6     16      42
Processing:     0    2   2.4      1      10
Waiting:        0    1   1.0      1       5
Total:         12   21   8.9     17      52

Percentage of the requests served within a certain time (ms)
  50%     17                   #50%的請求在17S完成
  66%     21                   #66%的請求在21S完成
  75%     22
  80%     27
  90%     34
  95%     36
  98%     52
  99%     52
 100%     52 (longest request)

 

(1)Requests per second吞吐率

服務器併發處理能力的量化描述,單位是reqs/s,指的是在某個併發用戶數下單位時間內處理的請求數。某個併發用戶數下單位時間內能處理的最大請求數,稱之爲最大吞吐率。

計算公式:Complete requests/Time taken for tests

(2)Time per request用戶平均請求等待時間

計算公式:Time token for tests/(Complete requests/Concurrency Level)。

(3)Time per requet(across all concurrent request)服務器平均請求等待時間

計算公式:Time taken for tests/Complete requests,正好是吞吐率的倒數。

相關文章
相關標籤/搜索