安装ab命令
yum -y install http-tools*
压测post请求
ab -n 100000 -c 1000 -T "application/json" -H "Content-Type: application/json" -p /root/post.txt https://gatewaysit.jrdaimao.com/easyhome-app-application/market/getFacilityService
参数说明:
-n:执行的请求个数,默认时执行一个请求
-c:一次产生的请求个数,即并发个数
-p:模拟post请求,post.txt 入参格式为json,json格式不需要转义{"marketId":844742927883309056}
-T:post数据所使用的Content-Type头信息,如果-T 'application/x-www-form-urlencoded'
模拟get请求
直接在url后面带参数即可
ab -c 10 -n 10 http://www.test.api.com/?gid=2