thinkphp beego swoft yaf 性能测试 压力测试 php go swoole 速度对比 数据读取

ab -n 10000 -c 200
  1. 统一使用ab在200并发进行10000次请求
  2. 为更接近实际使用,用各自模型读取了一条数据
  3. 测试机为腾讯云1核1G普通云硬盘,如果用ssd的话php成绩会有所提升
  4. 用nginx做转发,会限制golang性能发挥,压测nginx静态页面大概2157qps
首先需要说明,swoft和beego在裸跑时,效率爆棚,几乎逼近处理静态文件,速度是thinkphp的6-7倍.
增加nginx后有了较大耗损,差不多是thinkphp的1.7倍.
受制于nginx和fpm,yaf这种框架也只是比thinkphp提升了一丢丢,实际意义已经不大

thinkphp+nginx

253

大部分请求都比较慢,但是基本上是0.8S左右

Concurrency Level:      200
Time taken for tests:   39.601 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2280000 bytes
HTML transferred:       300000 bytes
Requests per second:    252.52 [#/sec] (mean)
Time per request:       792.025 [ms] (mean)
Time per request:       3.960 [ms] (mean, across all concurrent requests)
Transfer rate:          56.22 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       93  401  82.4    417     595
Processing:    96  385  93.6    370     750
Waiting:       96  384  93.6    369     750
Total:        337  785  76.1    788    1092

Percentage of the requests served within a certain time (ms)
  50%    788
  66%    817
  75%    835
  80%    847
  90%    879
  95%    900
  98%    934
  99%    951
 100%   1092 (longest request)

yaf+nginx(使用thinkphp的orm)

294

Concurrency Level:      200
Time taken for tests:   34.005 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2050000 bytes
HTML transferred:       300000 bytes
Requests per second:    294.08 [#/sec] (mean)
Time per request:       680.095 [ms] (mean)
Time per request:       3.400 [ms] (mean, across all concurrent requests)
Transfer rate:          58.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       91  341  82.6    357     533
Processing:   131  334  86.8    321     676
Waiting:      131  333  86.9    320     675
Total:        403  675  70.0    674     989

Percentage of the requests served within a certain time (ms)
  50%    674
  66%    701
  75%    717
  80%    730
  90%    766
  95%    792
  98%    824
  99%    858
 100%    989 (longest request)

beego+nginx

443

大部分请求比较快,只用了0.4S左右,但是有的请求又很慢,速度是thinkphp的1.8倍,考虑到php的易用,其实php还是让我满意的

Concurrency Level:      200
Time taken for tests:   22.580 seconds
Complete requests:      10000
Failed requests:        2
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 1)
Total transferred:      2259774 bytes
HTML transferred:       299970 bytes
Requests per second:    442.86 [#/sec] (mean)
Time per request:       451.606 [ms] (mean)
Time per request:       2.258 [ms] (mean, across all concurrent requests)
Transfer rate:          97.73 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  343 549.6    164   15759
Processing:    24   93 122.0     39    7019
Waiting:       24   92 100.4     39    1005
Total:         98  436 561.5    336   16048

Percentage of the requests served within a certain time (ms)
  50%    336
  66%    391
  75%    437
  80%    494
  90%   1124
  95%   1378
  98%   2095
  99%   2382
 100%  16048 (longest request)

beego(无nginx)

1545

Concurrency Level:      200
Time taken for tests:   6.472 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      1470000 bytes
HTML transferred:       300000 bytes
Requests per second:    1545.04 [#/sec] (mean)
Time per request:       129.447 [ms] (mean)
Time per request:       0.647 [ms] (mean, across all concurrent requests)
Transfer rate:          221.80 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       24   30   4.0     30      40
Processing:    24   99  42.4     87     260
Waiting:       24   99  42.4     86     260
Total:         48  128  43.2    117     290

Percentage of the requests served within a certain time (ms)
  50%    117
  66%    143
  75%    157
  80%    165
  90%    189
  95%    208
  98%    234
  99%    264
 100%    290 (longest request)

swoft+nginx

442

Concurrency Level:      200
Time taken for tests:   22.623 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2460000 bytes
HTML transferred:       300000 bytes
Requests per second:    442.04 [#/sec] (mean)
Time per request:       452.452 [ms] (mean)
Time per request:       2.262 [ms] (mean, across all concurrent requests)
Transfer rate:          106.19 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       73  305 403.0    220    8746
Processing:    24  130  91.1    142    1008
Waiting:       24  129  91.0    142    1008
Total:         98  434 406.4    394    8966

Percentage of the requests served within a certain time (ms)
  50%    394
  66%    429
  75%    453
  80%    465
  90%    618
  95%   1149
  98%   1576
  99%   2021
 100%   8966 (longest request)

swoft(无nginx)

1768

Concurrency Level:      200
Time taken for tests:   5.658 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2140000 bytes
HTML transferred:       300000 bytes
Requests per second:    1767.53 [#/sec] (mean)
Time per request:       113.152 [ms] (mean)
Time per request:       0.566 [ms] (mean, across all concurrent requests)
Transfer rate:          369.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       24   47 129.6     30    1038
Processing:    24   61  38.1     61     510
Waiting:       24   61  38.1     61     510
Total:         48  108 136.3     89    1328

Percentage of the requests served within a certain time (ms)
  50%     89
  66%     98
  75%     99
  80%    104
  90%    110
  95%    125
  98%    322
  99%   1080
 100%   1328 (longest request)

相关文章

此处评论已关闭