最新消息:

Yaf 2.1性能测试(Yaf 2.1 Benchmark)

PHP应用 admin 3556浏览 0评论

Thanks to Ruilog agian for his work of second benchmark of Yaf 2.1.

Yaf 2.1 (docs) did a lot of work to improve performance and reduce memory usage, so let’s take a look at the result(Yaf 2.1重写了很多逻辑来提升性能, 并且降低内存使用率, 改进结果见测试对比):

First of all, I have to say, I am not saying the fastest is the best. every framework list blew is outstanding, and has particular situation to deploy. (首先, 我要申明, 不一定最快的就是最好的, 下面的每一个框架都是优秀的框架, 都有它们适用的场景)

Case

Test Simple “Hello World” page output, Simple MVC logic(Router -> Controller -> Viewer), No Database Connections, No complex logic. Test scripts can be found here.

Hardware platform

  • CPU: Intel Core i5 750 (2.67GHz x4)
  • RAM: 4GB

Software Environment

  • Debian 6.0.3 x86_64 (2.6.32-39)
  • apache 2.2.16 (mpm-prefork,mod-php5)
  • php 5.3.8
  • php-apc 3.1.9 (Optimization for include/require)
  • Copy all projects to /dev/shm/* (Optimization for files read/write)

1. Apache Benchmark

Requests pre second (-c 100 -n 30000), the bigger is better

ab -c100 -n30000

Requests pre second (-c 200 -n 50000), the bigger is better

ab -c200 -n50000

2. System LoadAvg

System LoadAvg in 1 Minute when Apache Benchmark Complete, the smaller is better (-c 100 -n 30000)

System loadavg

3. Memory usage

How many memory usage in one “hello world” page. the smaller is better.

Memory usage

4. Response time

The time of page request to response.

Response time

5.Number of function calls (Facebook XHProf)

The number of functions calls in one “hello world” page.

Number of function calls

6. Number of included files

The number of files included or required in one “hello world” page. the fewer is better.

Number of included files

Changelog:
  * v20111201 @2011-12-01
    - release
  * v20111201-2 @2011-12-05
    - bugfix: Fix a stupid logic error in bench.php
    - bugfix: Symfony2, Change running mode from 'dev' to 'prod'

–EOF–

For more details, plz refer to: http://www.ruilog.com/blog/view/b6f0e42cf705.html


Comments

  • 2011/12/02, Yaf的性能对比测试 | 风雪之隅 writes: […] 后记(2011-12-02补充), Yaf 2.1做一些性能优化的升级, 基于Yaf 2.1的性能测试报告可以参见: Yaf 2.1性能测试(Yaf 2.1 Benchmark) […]
  • 2011/12/02, 东爷 writes: 牛
  • 2011/12/02, Wellming writes: 哇塞,Yaf好快耶!

    不过symfony2没这么慢吧,性能测试的时候应该用app.php,app_dev.php是开发用的。

  • 2011/12/02, KnightE writes: 目录结构中有提到model层,但文档中似乎并未看到。API里也看不到db操作的代码和例子,能否给些例子参考一下。
  • 2011/12/02, Eryx writes: 解释下 app_dev.php 问题:

    刚开始的时候,常识用 app.php 引导,但失败(500 error); 而同时 app_dev.php 正常,为了消除 debug 对性能的影响,在 config_dev.yml 中做了如下修改 ([web_profiler] toolbar: false; intercept_redirects: false). 使其可以输出一个干净的 “hello world”.
    我想,虽然名称上叫做 “dev”, 但实际配置应该和 “app.php” 等同.

    Symfony 是一个历史悠久、成熟的商业框架,但我却是第一次使用,如果你有更优化的配置,期待您提交补丁 🙂

  • 2011/12/03, helloyou writes: 关于yaf,记得你说过yaf是仿Zfw的,

    如果能有个工具帮助现有的ZFW项目快速转换到yaf上,
    或者有一个bridge工具来让现有zfw直接在yaf上运行,

    应该会让yaf更容易普及

    还有上次说的,要有英文手册

  • 2011/12/03, xiatian writes: win下用nginx+php(fcgi)方式无法加载php_yaf.dll,不管是nts还是zts.

    提示错误:
    “E:webServerphpextphp_yaf.dll”的激活上下文生成失败。 找不到从属程序集 Microsoft.VC90.DebugCRT,processorArchitecture=”x86″,publicKeyToken=”1fc8b3b9a1e18e3b”,type=”win32″,version=”9.0.21022.8″。 请使用 sxstrace.exe 进行详细诊断。

  • 2011/12/03, kernel writes: symfony2这么差啊,ps: yii的表现还不错啊,于是继续用yii
  • 2011/12/03, Wellming writes: @Eryx 你看下app.php跟app_dev.php文件,

    $kernel = new AppKernel(‘prod’, false);
    $kernel = new AppKernel(‘dev’, true);

    这里第2个参数是,是否开启debug。

  • 2011/12/05, venkman writes: 如果虚拟主机上的php不支持或没有安装这个扩展, 那么推广还是有一定的
  • 2011/12/05, Eryx writes: @Wellming Symfony2 的配置确实存在问题,切换到 prod模式后并发大概是 400+, 介于 ZF 1.11 和 2.0 之间
  • 2011/12/06, Thinklong writes: 非常喜欢你的框架,但我希望能让ZendStudio自动提示Yaf里的方法和类,搞了很久,zend6以上的版本无法添加*.so库,鸟哥有没有抽象出来的code文件,或者其他实现方式?
  • 2011/12/06, 雪候鸟 writes: @thinklong 我这边没有, 不过你可以借助reflectclass自己生成一个 🙂
  • 2011/12/06, dvaknheo writes: 我现在在给某个框架集成支付,搞得很头大。

    后来想想,为什么一定要把支付搞在框架里,直接弄个单独的文件不行么?
    再后来想想, 不行, 那样就就搞得系统零碎。

  • 2011/12/07, Anonymous writes: @雪候鸟 非常感谢!我已经用ReflectionClass把Yaf扩展里的类都抽象出来了,写的很简单,不过可以用^ ^ 这下在zend里开发就方便多了,有需要的同学可以到下面的链接下载http://code.google.com/p/thinklong/downloads/detail?name=Yaf.php&can=2&q=#makechanges
  • 2011/12/24, adam.lu writes: Hi, Laruence.

    我在mac os x 10.7.2 上无法安装yaf-2.1.4。

    运行phpzie的时候提示:
    configure.in:3: warning: prefer named diversions
    configure.in:3: warning: prefer named diversions

    运行make的时候提示:
    yaf.c:265: warning: initialization makes integer from pointer without a cast
    yaf.c:266: warning: initialization makes integer from pointer without a cast
    yaf.c:266: error: initializer element is not computable at load time
    yaf.c:266: error: (near initialization for ‘yaf_module_entry.module_number’)
    make: *** [yaf.lo] Error 1

  • 2011/12/24, 雪候鸟 writes: @adam.lu 请问你的PHP的版本是?
  • 2011/12/25, adam.lu writes: mac os 中的php版本试5.3.8

    我在ubuntu中安装编译没有问题,php版本是5.3.3。可是在php.ini中加入扩展(extension=yaf.so)后,apache就无法启动成功:(

  • 2011/12/25, laruence writes: @adam.lu 你可以打开php.ini中的display_startup_error看看有什么错误
  • 2011/12/26, keda writes: gcc (Debian 4.4.5-8) 4.4.5 64bit系统。
    跟Adam Lu的error一样。。
    yaf.c:265: warning: initialization makes integer from pointer without a cast
    yaf.c:266: warning: initialization makes integer from pointer without a cast
    yaf.c:266: error: initializer element is not computable at load time
    yaf.c:266: error: (near initialization for ‘yaf_module_entry.module_number’)
    2.1.3却又没有问题。。
    我用另一架32bit的debian编译却没有这个问题。。
  • 2011/12/26, laruence writes: @keda @adam.lu 非常感谢你们的反馈, 问题已经修复. 请使用2.1.5beta http://pecl.php.net/package-info.php?package=yaf&version=2.1.5
  • 2011/12/31, adam.lu writes: Hi, laruence
    我已经在mac下成功编译了2.1.5
    可是在phpize的时候仍然会有一下的warning信息,不知道会不会影响使用。
    Configuring for:
    PHP Api Version: 20090626
    Zend Module Api No: 20090626
    Zend Extension Api No: 220090626
    configure.in:3: warning: prefer named diversions
    configure.in:3: warning: prefer named diversions

    另外,http://yaf.laruence.com/manual/这个手册还在维护吗?我看到手册中还有不少地方是使用ap而不是yaf这个叫法。


Related posts:


Copyright © 2010 风雪之隅 版权所有, 转载务必注明. 该Feed只供个人使用, 禁止未注明的转载或商业应用. 非法应用的, 一切法律后果自负. 如有问题, 可发E-mail至my at laruence.com.(Digital Fingerprint: 73540ba0a1738d7d07d4b6038d5615e2)

Related Posts:

转载请注明:爱开源 » Yaf 2.1性能测试(Yaf 2.1 Benchmark)

您必须 登录 才能发表评论!