前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >为什么 wrk 和 ab, locust 压测的结果差异这么大?

为什么 wrk 和 ab, locust 压测的结果差异这么大?

作者头像
随心助手
发布2019-10-15 11:23:43
1.7K0
发布2019-10-15 11:23:43
举报
文章被收录于专栏:nginx遇上redisnginx遇上redis

本地使用 wrk 压测 nginx 的一个 hello,world!接口。wrk 的 qps 是 20 多万,全部 200 状态吗,无异常。ab 结果是 1 万多的 qps,locust 只有 6 千多的 qps。本机 32 核 CPU,结果差异这么大,请问该相信哪个呢?

下面是压测过程:

  • wrk
代码语言:javascript
复制
./wrk -c 10000 -d 20  http://localhost:8080/status
Running 20s test @ http://localhost:8080/status
  2 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.51ms  654.52us  14.36ms   90.56%
    Req/Sec   105.08k     6.58k  133.08k    72.08%
  4150775 requests in 20.10s, 783.58MB read
  Socket errors: connect 8981, read 0, write 0, timeout 0
Requests/sec: 206509.01
Transfer/sec:     38.98MB

查看请求数量cat access.log|wc -l,结果4089174,打开检查都是 200 状态吗,无错误。ab 压测-c 10000 报错,为了一致,使用 wrk 压测-c 1000,qps 的值为216547.69

  • ab
代码语言:javascript
复制
ab -c 1000 -n 200000 http://localhost:8080/status
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 20000 requests
Completed 40000 requests
Completed 60000 requests
Completed 80000 requests
Completed 100000 requests
Completed 120000 requests
Completed 140000 requests
Completed 160000 requests
Completed 180000 requests
Completed 200000 requests
Finished 200000 requests


Server Software:        openresty/1.13.6.1
Server Hostname:        localhost
Server Port:            8080

Document Path:          /status
Document Length:        12 bytes

Concurrency Level:      1000
Time taken for tests:   18.040 seconds
Complete requests:      200000
Failed requests:        0
Total transferred:      31000000 bytes
HTML transferred:       2400000 bytes
Requests per second:    11086.72 [#/sec] (mean)
Time per request:       90.198 [ms] (mean)
Time per request:       0.090 [ms] (mean, across all concurrent requests)
Transfer rate:          1678.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   40  51.9     37    1048
Processing:     1   50  11.8     49     243
Waiting:        1   37  13.2     33     221
Total:          2   90  52.7     89    1104

Percentage of the requests served within a certain time (ms)
  50%     89
  66%     91
  75%     93
  80%     94
  90%     99
  95%    104
  98%    113
  99%    129
 100%   1104 (longest request)

加上 -k参数 qps 就只有 9800。

  • locust

启动了一个 master,28 个 slave,结果 qps 只有 6700 左右,请问哪个比较接近真实?

接口就是直接安装 openresty,无优化,配置里面 echo "hello,world!"

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-07-22,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 nginx遇上redis 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档