桃之夭夭,灼灼其华

ab并发测试工具

Word count: 167Reading time: 1 min
2020/07/03 Share

命令

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

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

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

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

  • 模拟get请求

    1
    ab -n 10 -c 10 http://www.baidu.com/
  • 模拟post请求
    在当前目录下创建一个文件post.txt,编辑文件post.txt写入cid=4&status=1相当于post传递cid,status参数.

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

    ab -n50 -c20 -p 'post.txt' -T 'application/json' 'http://192.168.250.79:9081/admin/letsapi/attendance/jwdownworkdatarelay'

    52b2175e0863805afdf4d0f3e6c1c86b.png

CATALOG
  1. 1. 命令