swoole 协程异步 带来的性能提升 压力测试

均访问同一cdn数据,模拟访问远程接口的情况

协程异步

2009qps

同步阻塞

432qps

协程压测

Concurrency Level:      200
Time taken for tests:   0.498 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      209000 bytes
HTML transferred:       19000 bytes
Requests per second:    2009.49 [#/sec] (mean)
Time per request:       99.528 [ms] (mean)
Time per request:       0.498 [ms] (mean, across all concurrent requests)
Transfer rate:          410.14 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       24   30   4.0     30      37
Processing:    28   61  14.8     59     121
Waiting:       28   61  14.8     58     121
Total:         52   91  17.3     89     158

Percentage of the requests served within a certain time (ms)
  50%     89
  66%     95
  75%    100
  80%    103
  90%    111
  95%    122
  98%    139
  99%    144
 100%    158 (longest request)

同步阻塞压测

Concurrency Level:      200
Time taken for tests:   2.315 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      209000 bytes
HTML transferred:       19000 bytes
Requests per second:    432.01 [#/sec] (mean)
Time per request:       462.951 [ms] (mean)
Time per request:       2.315 [ms] (mean, across all concurrent requests)
Transfer rate:          88.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       24   30   4.0     30      38
Processing:    35  385  85.2    412     513
Waiting:       35  385  85.2    411     513
Total:         59  415  86.4    441     549

Percentage of the requests served within a certain time (ms)
  50%    441
  66%    455
  75%    461
  80%    466
  90%    479
  95%    488
  98%    497
  99%    505
 100%    549 (longest request)

相关文章

此处评论已关闭