您的位置:首页 > 运维架构 > Apache

Apache Bench——ab性能测试工具

2018-02-23 11:32 239 查看
ab是一种用于测试Apache超文本传输协议(HTTP)服务器的工具。apache自带ab工具,可以测试apache、IIs、tomcat、nginx等服务器但是ab没有Jmeter、Loadrunner那样有各种场景设计、各种图形报告和监控,只需一个命令即可,有输出描述可以简单的进行一些压力测试
一、Mac下自带apache查看版本 apachectl -v

以请求百度为例:http://httpd.apache.org/docs/2.4/programs/ab.html 详细说明见官网ab命令同时满足http及https的请求常用请求参数:-n请求次数,-c并发数Wx-MacBookPro:apache2 wuxi$ ab -n 100 -c 10 https://www.baidu.com/This is ApacheBench, Version 2.3 <$Revision: 1757674 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation, http://www.apache.org///apache版本信息Benchmarking www.baidu.com (be patient).....done

Server Software: BWS/1.1//请求返回header类型,可能是nginx、apache、IIs等Server Hostname: www.baidu.com//请求ip或者域名Server Port: 443//请求端口,当前请求为https所以端口为443,请求https端口80SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128//https端口协议TLS Server Name: www.baidu.com
Document Path: ///路径Document Length: 227 bytes//第一个成功返回的文档的字节大小Concurrency Level: 10//并发数!!!Time taken for tests: 1.034 seconds//从建立连接到最后接受完成总时间Complete requests: 100//总请求数成功的Failed requests: 0//失败的Total transferred: 87200 bytes//从服务器接收的字节总数HTML transferred: 22700 bytes//HTML接收字节数Requests per second: 96.75 [#/sec] (mean)————每秒请求数(总请求数/总时间)Time per request: 103.359 [ms] (mean)————用户平均请求等待时间=concurrency * timetaken * 1000 / done参考Jmeter、LR中的平均响应时间Time per request: 10.336 [ms] (mean, across all concurrent requests)————服务器处理每个请求平均响应时间=timetaken * 1000 / doneTransfer rate: 82.39 [Kbytes/sec] received
Connection Times (ms)min mean[+/-sd] median maxConnect: 41 75 16.1 74 121Processing: 10 23 12.7 19 63Waiting: 10 21 10.8 18 54Total: 62 99 18.5 97 168//网络连接情况Percentage of the requests served within a certain time (ms)50% 97 66% 10475% 10780% 11090% 12695% 13898% 14899% 168100% 168 (longest request)//整体响应时间的分布比
二、Win环境下:下载地址:https://www.apachelounge.com/download/1、ab测试http请求2、abs测试https请求abs.exe -n 500 -c 100 -p C:\Users\Desktop\ab\cc.txt -T 'application/x-www-form-urlencoded' "https://xxx/mobileHandler.do"
参数:-n是次数,-c是并发数,-p是参数路径,url是""双引号post请求: -T application/x-www-form-urlencoded具体参数意义参考官网




默认是text/plan,需要根据实际情况自己指定
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: