swoole并没有你说的那么好,@韩天峰

这两年“世上最好的语言”PHP诟病于连接处理性能上,在热门语言排行榜上已显得有些后劲不足。
特别是在公司内部也掀起了一股php转go的潮流,那么作为PHP的拥护者,我内心是拒绝的。

所以当看到swoole作者在官方文档上写着“swoole的性能远远超过go自带的http和nodejs自带的http”
,我内心是无比澎湃激动的,于是我对几种语言做了个性能测试对比,想想做完测试把报告一甩,能甩go几条街。但是结果却另我有点失望,

Swoole 并没有想象中那么好, 也就比php好一点点。并没有作者说的那么牛逼,@韩天峰
https://wiki.swoole.com/wiki/page/326.html

PHP + FPM

Server Software:        nginx/1.6.2
Server Hostname:        bug.3322.org
Server Port:            80

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      1
Time taken for tests:   15.185 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      780000 bytes
HTML transferred:       55000 bytes
Requests per second:    329.26 [#/sec] (mean)
Time per request:       3.037 [ms] (mean)
Time per request:       3.037 [ms] (mean, across all concurrent requests)
Transfer rate:          50.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.2      1       3
Processing:     1    2   1.3      2      65
Waiting:        1    2   1.3      2      65
Total:          2    3   1.3      3      66

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      3
  90%      4
  95%      4
  98%      4
  99%      5
 100%     66 (longest request)


Nodejs
Server Software:       
Server Hostname:        192.168.1.4
Server Port:            8888

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      1
Time taken for tests:   3.964 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      565000 bytes
HTML transferred:       60000 bytes
Requests per second:    1261.22 [#/sec] (mean)
Time per request:       0.793 [ms] (mean)
Time per request:       0.793 [ms] (mean, across all concurrent requests)
Transfer rate:          139.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       4
Processing:     0    0   0.2      0       4
Waiting:        0    0   0.2      0       4
Total:          0    1   0.3      1       7

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%      2
 100%      7 (longest request)

GO
Server Software:       
Server Hostname:        192.168.1.4
Server Port:            9000

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      1
Time taken for tests:   3.913 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      640000 bytes
HTML transferred:       55000 bytes
Requests per second:    1277.71 [#/sec] (mean)
Time per request:       0.783 [ms] (mean)
Time per request:       0.783 [ms] (mean, across all concurrent requests)
Transfer rate:          159.71 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       5
Processing:     0    0   0.2      0       5
Waiting:        0    0   0.2      0       4
Total:          0    1   0.3      1       5

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%      2
 100%      5 (longest request)

Swoole + php
docker run --rm jordi/ab ab  -n 5000 http://172.16.0.220:9501/
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 172.16.0.220 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software:        swoole-http-server
Server Hostname:        172.16.0.220
Server Port:            9501
Document Path:          /
Document Length:        28 bytes
Concurrency Level:      1
Time taken for tests:   12.821 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      955000 bytes
HTML transferred:       140000 bytes
Requests per second:    389.97 [#/sec] (mean)
Time per request:       2.564 [ms] (mean)
Time per request:       2.564 [ms] (mean, across all concurrent requests)
Transfer rate:          72.74 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.5      1      10
Processing:     1    2  14.3      1    1009
Waiting:        0    2  14.3      1    1008
Total:          1    2  14.3      2    1010
Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      3
  90%      3
  95%      4
  98%      6
  99%      7
 100%   1010 (longest request)
--------------------- https://blog.csdn.net/kexiaoling/article/details/80516097

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值