技术&日志

ab-压力测试-laradock

  1. docker-compose build apache2
  2. docker run -it --name apache2 --net=host laradock_apache2 bash
  3. ab -n 100 -c 10 http://test.com/
  • 其中-n表示请求数,-c表示并发数
  • Requests per second: 19.66 [#/sec] (mean) 吞吐率 LR 中的每秒事务数,后面括号中的 mean 表示这是一个平均值
  • Time per request: 5087.180 [ms] (mean) 用户平均请求等待时间,大家最关心的指标之二,相当于 LR 中的平均事务响应时间,后面括号中的 mean 表示这是一个平均值
  • Time per request: 50.872 [ms] (mean, across all concurrent requests) 服务器平均请求处理时间,大家最关心的指标之三

POST请求

编辑文件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工具
apahce的ab工具测试nginx服务

发表评论