首页 > 其他 > 详细

ab压力测试之post与get请求

时间:2016-08-15 18:56:15      阅读:305      评论:0      收藏:0      [点我收藏+]

 

安装ab工具

 yum install httpd-tools 

参数说明

-n:执行的请求个数,默认时执行一个请求

-c:一次产生的请求个数,即并发个数

-p:模拟post请求,文件格式为gid=2&status=1,配合-T使用

-T:post数据所使用的Content-Type头信息,如果-T ‘application/x-www-form-urlencoded‘

 

1.模拟get请求
直接在url后面带参数即可

ab -c 10 -n 10 http://www.test.api.com/?gid=2

 

?

2.模拟post请求

在当前目录下创建一个文件post.txt

编辑文件post.txt写入

cid=4&status=1

相当于post传递cid,status参数

ab -n 100  -c 10 -p post.txt -T application/x-www-form-urlencoded http://test.api.com/ttk/auth/info/

 

ab压力测试之post与get请求

原文:http://www.cnblogs.com/lisqiong/p/5773738.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!