thinkphp5 yaf easyswoole mixphp 性能对比一下做个记录

服务器vm虚拟机 1核1G

 环境 :nginx/1.13.8  +    php7.2.1 + mysql 5.7.2

 环境 :swoole 2.0.12

mixphp 2.0.1

默认代码:

 class IndexController extends Controller { // 默认动作 public function actionIndex() { return 'Hello World' . PHP_EOL; }


ab -c 150 -n 100000 http://192.168.11.109:9501/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:        swoole-http-server

Server Hostname:        192.168.11.109

Server Port:            9501

Document Path:          /

Document Length:        12 bytes

Concurrency Level:      150

Time taken for tests:  24.486 seconds

Complete requests:      100000

Failed requests:        0

Total transferred:      17400000 bytes

HTML transferred:      1200000 bytes

Requests per second:    4083.92 [#/sec] (mean)

Time per request:      36.729 [ms] (mean)

Time per request:      0.245 [ms] (mean, across all concurrent requests)

Transfer rate:          693.95 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median  max

Connect:        0    1  28.3      0    1091

Processing:    2  36  14.1    34    506

Waiting:        2  35  14.1    34    506

Total:          2  37  31.6    34    1128

Percentage of the requests served within a certain time (ms)

  50%    34

  66%    36

  75%    37

  80%    38

  90%    44

  95%    53

  98%    66

  99%    84

 100%  1128 (longest request)





easyswoole 2.0.1

代码:

<?php

namespace App\Controller;

use EasySwoole\Core\Http\AbstractInterface\Controller;

class Index extends Controller

{

    function index()

    {

      $this->response()->write("hello word!!");

        // TODO: Implement index() method.

    }

}

?>


ab -c 150 -n 100000 http://192.168.11.109:9501/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:        swoole-http-server

Server Hostname:        192.168.11.109

Server Port:            9501

Document Path:          /

Document Length:        21 bytes

Concurrency Level:      150

Time taken for tests:  33.115 seconds

Complete requests:      100000

Failed requests:        0

Total transferred:      17700000 bytes

HTML transferred:      2100000 bytes

Requests per second:    3019.74 [#/sec] (mean)

Time per request:      49.673 [ms] (mean)

Time per request:      0.331 [ms] (mean, across all concurrent requests)

Transfer rate:          521.97 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median  max

Connect:        0    0  0.6      0      11

Processing:    8  49  19.3    48    223

Waiting:        7  49  19.3    48    221

Total:          8  50  19.4    48    232

Percentage of the requests served within a certain time (ms)

  50%    48

  66%    57

  75%    63

  80%    66

  90%    74

  95%    81

  98%    88

  99%    95

 100%    232 (longest request)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

yaf3.0.6在php-fpm下运行结果


代码:


<?php

define ("APPLICATION_PATH",  dirname(__FILE__));

$app  = new Yaf_Application(APPLICATION_PATH . "/conf/application.ini");

$app->bootstrap() //call bootstrap methods defined in Bootstrap.php

->run();

?>


ab -c 150 -n 100000 http://192.168.11.109/yaf/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:        nginx/1.13.8

Server Hostname:        192.168.11.109

Server Port:            80

Document Path:          /yaf/

Document Length:        11 bytes

Concurrency Level:      150

Time taken for tests:  63.561 seconds

Complete requests:      100000

Failed requests:        0

Total transferred:      17300000 bytes

HTML transferred:      1100000 bytes

Requests per second:    1573.30 [#/sec] (mean)

Time per request:      95.341 [ms] (mean)

Time per request:      0.636 [ms] (mean, across all concurrent requests)

Transfer rate:          265.80 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median  max

Connect:        0    0  0.4      0      8

Processing:    42  94 112.7    83    3101

Waiting:      42  94 112.7    83    3101

Total:        42  94 112.7    83    3101

Percentage of the requests served within a certain time (ms)

  50%    83

  66%    84

  75%    86

  80%    87

  90%    92

  95%    95

  98%    109

  99%  1067

 100%  3101 (longest request)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


thinkphp5.0.14

代码:

namespace app\index\controller;

class Index{ 

public function index(){

return 'index'; 

 }

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ab -c 150 -n 100000 http://192.168.11.109/thinkphp5/public/

This is ApacheBench, Version 2.3 <$Revision: 1748469 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.11.109 (be patient)

Completed 10000 requests

Completed 20000 requests

Completed 30000 requests

Completed 40000 requests

Completed 50000 requests

Completed 60000 requests

Completed 70000 requests

Completed 80000 requests

Completed 90000 requests

Completed 100000 requests

Finished 100000 requests

Server Software:        nginx/1.13.8

Server Hostname:        192.168.11.109

Server Port:            80

Document Path:          /thinkphp5/public/

Document Length:        11 bytes

Concurrency Level:      150

Time taken for tests:  113.376 seconds

Complete requests:      100000

Failed requests:        0

Total transferred:      17300000 bytes

HTML transferred:      1100000 bytes

Requests per second:    882.02 [#/sec] (mean)

Time per request:      170.065 [ms] (mean)

Time per request:      1.134 [ms] (mean, across all concurrent requests)

Transfer rate:          149.01 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median  max

Connect:        0    0  0.6      0      12

Processing:    18  168 151.2    140    3209

Waiting:      17  168 151.2    140    3209

Total:        22  169 151.2    141    3209

Percentage of the requests served within a certain time (ms)

  50%    141

  66%    151

  75%    160

  80%    164

  90%    178

  95%    210

  98%  1120

  99%  1145

 100%  3209 (longest request)


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,980评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,178评论 2 380
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,868评论 0 336
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,498评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,492评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,521评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,910评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,569评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,793评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,559评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,639评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,342评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,931评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,904评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,144评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,833评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,350评论 2 342

推荐阅读更多精彩内容