首页 技术 正文
技术 2022年11月8日
0 收藏 365 点赞 1,778 浏览 805 个字

ab命令格式:-N|–count 总请求数,缺省 : 5w-C|–clients 并发数, 缺省 : 100-R|–rounds 测试次数, 缺省 : 10 次-S|-sleeptime 间隔时间, 缺省 : 10 秒-I|–min 最小并发数, 缺省: 0-X|–max 最大并发数,缺省: 0-J|–step 次递增并发数-R|–runtime 总体运行时间,设置此项时最大请求数为5w-P|–postfile post数据文件路径-U|–url 测试地址

要使用ab进行post数据测试.从help可以看出我们需要定义两个内容
一个是-p参数.指定需要post的数据
还有一个是-T参数,指定使用的content-type

eg :  ab -n 3 -c 3 -p post.txt -T application/x-www-form-urlencoded http://192.168.1.176:8080/xx.do

另外,post.txt里面的post数据要放你的json数据,比如data={“id”:”1234″}但是注意要进行urlencode加密,于是真正放在post.txt里面的内容就是data=%7B%22id%22%3A%221234%22%7D,还有要注意,不要自己在windows上建一个post.txt放数据,而是使用比如eclipse或者notepad++,因为自己建一个txt会在文件开头有一个特殊字符,这样解析不了。我是用的intellij idea开发,用它建的txt文件。搞好之后你再ab以下肯定可以了。。。。

-p选项指定post文件的位置;-T选项指定post文件的编码方式,默认是明文,如果指定-T ‘application/x-www-form-urlencoded’,则表示post文件使用urlencode

注:content-type一定要设置成为application/x-www-form-urlencoded

    

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,493
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,294