Linux下使用ApacheBench进行压力测试

安装ApacheBench命令
[root@localhost ~]# yum install -y httpd-tools
 
 
 
查看ApacheBench版本号
[root@localhost ~]# ab -V
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
[root@localhost ~]# 
 
 
 
压力测试命令示例
[root@localhost ~]# ab -c 10 -n 100 https://www.baidu.com/ # -c为请求用户数,-n为请求总数
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
 
Benchmarking www.baidu.com (be patient).....done
 
 
Server Software:        BWS/1.1
Server Hostname:        www.baidu.com
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128
 
Document Path:          /
Document Length:        227 bytes
 
Concurrency Level:      10
Time taken for tests:   0.711 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      111096 bytes
HTML transferred:       22700 bytes
Requests per second:    140.60 [#/sec] (mean)
Time per request:       71.124 [ms] (mean)
Time per request:       7.112 [ms] (mean, across all concurrent requests)
Transfer rate:          152.54 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       31   48   7.1     48      68
Processing:     9   15   3.4     15      26
Waiting:        9   15   3.4     14      26
Total:         42   63   9.3     63      89
 
Percentage of the requests served within a certain time (ms)
  50%     63
  66%     66
  75%     68
  80%     70
  90%     76
  95%     81
  98%     85
  99%     89
 100%     89 (longest request)
[root@localhost ~]#

Copyright © 2024 码农人生. All Rights Reserved