欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ApacheBench(ab)测试工具小结

程序员文章站 2022-07-13 21:28:24
...

1.安装

如果已经安装Apache,则以及自带了ab测试工具;

下面进行最简安装

 

#yum install httpd-tools

 

2.web负债测试

 

常用命令:ab -n 400 -c 200 -k http://caicongyang.com:8080/

-n :发起请求次数

-c :并发数

-k 保持keep-alived

3.结果详解

 

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking caicongyang.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Finished 400 requests

#测试服务器类型
Server Software:        Apache-Coyote/1.1
#主机
Server Hostname:        caicongyang.com
#端口
Server Port:            8080
#路径
Document Path:          /
#文件长度
Document Length:        11398 bytes  
#并发级别
Concurrency Level:      200
#总耗时
Time taken for tests:   67.469688 seconds
#成功完成请求次数
Complete requests:      400
#失败次数
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      4617600 bytes
HTML transferred:       4559200 bytes
<span style="color:#ff0000;">#每秒处理请求次数(平均值)</span>
Requests per second:    5.93 [#/sec] (mean)
<span style="color:#ff0000;">#平均每次请求服务器处理完成时间/整个请求流程</span>
Time per request:       33734.844 [ms] (mean)
<span style="color:#ff0000;">#平均每次服务器处理时间/实际处理时间</span>
Time per request:       168.674 [ms] (mean, across all concurrent requests)
<span style="color:#ff0000;">#网络吞吐量</span>
Transfer rate:          66.83 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       31   46  70.2     38    1437
Processing:  1184 17633 14533.1  13306   67431
Waiting:       34 9351 13565.1   3887   67324
Total:       1220 17679 14534.8  13344   67468

 

平均等待时间 = 平均每次处理完成时间-服务器实际处理时间

 

 

 

ps:网络上的文章前篇一率,写的拗口难以理解!

 

 

 

更多精彩内容请继续关注我的博客http://blog.csdn.net/caicongyang

记录与分享,你我共成长 -fromcaicongyang

 

 

相关标签: 测试工具