码迷,mamicode.com
首页 > 其他好文 > 详细

ab压力测试之post与get请求

时间:2016-08-15 18:57:20      阅读:111      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!