原文
AB(ApacheBench) 是 Apache 自带的超文本传输协议 (HTTP) 性能测试工具。 其设计意图是描绘当前所安装的 Apache 的执行性能, 主要是显示 Apache 每秒可以处理多少个请求。
使用 ab -help 查看帮助界面
-
ab测试简单http请求
ab -n30000 -c1000 "http://10.1.1.21:8080/" -
ab 测试 http 接口 (POST)
ab -n400 -c20 -p "img.json" -T "application/x-www-form-urlencoded" "http://10.1.1.21:8080/test.do"img.json 为符合接口格式的字符串
MIME 类型 application/x-www-form-urlencoded 与 multipart/form-data 和 text/plain 参考
类似于 curl,curl 指定 post 请 @ 指定文件
curl "http://10.1.1.21:8080/test.do" -d @/root/img.json -
ab 测试 webservice 接口
ab -k -T "Content-Type:text/xml;charset=UTF-8" -p data.xml -n 1000 -c 32 http://10.1.1.21:8080/services/routeService?wsdl注意:data.xml 必须符合 wsdl 规范,可以使用 soapUI 生成
如果报错: no soapaction header
ab -k -T "Content-Type:text/xml;charset=UTF-8;soapaction=''" -p data.xml -n 1000 -c 32 http://10.1.1.21:8080/services/routeService?wsdl
本文介绍了 ApacheBench (ab) 工具用于测试 HTTP 性能及接口请求的方法,包括简单 HTTP 请求、POST 请求及 Web Service 接口测试,并提供了相关参数设置和常见错误解决技巧。
3469

被折叠的 条评论
为什么被折叠?



