将 Zend Framework 用于高负载项目 [英] Using Zend Framework for highload projects

查看:16
本文介绍了将 Zend Framework 用于高负载项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Zend Framework 是一个很好的框架,但速度不是很快.您能否判断将 Zend Framework 用于高负载项目是否值得,例如,对于可能包含大约十或数千名用户的电子邮件营销服务?使用 Zend Framework 是否可以达到可接受的性能?有人有这样的经历吗?非常感谢.

解决方案

就我所见,对 Zend Framework 性能的最终防御和性能优化建议来自 Padraic Brady:

PHP 框架基准:有趣但最终没用

特别要注意他关于性能优化的四项建议:

<块引用>

  1. 不要使用 Zend_Application.虽然 Zend_App 非常适合在标准化结构中创建一致的复杂引导程序,但它对基线性能的影响也很大.更直接的引导程序(ZF 在 Zend_App 到来之前是典型的)要快得多,而且无需配置文件即可完成.

  2. 跳过使用 ViewRenderer 插件.如果没有 ViewRenderer,您需要手动配置 Zend_View 并向控制器添加 render() 调用.这实际上非常简单,而且速度相当快 - 速度从来都不是 ViewRenderer 遗传学的真正组成部分.

  3. 使用自动加载.从框架库中去除 require_once 调用,以便忽略不需要的文件.用一个不那么疯狂的自动加载器函数替换 Zend_Loader_Autoloader 的使用.事实上,祈祷 Zend_Loader 永远不会被使用——它执行了很多文件操作,迄今为止,我从未向我解释过这些操作具有任何价值.

  4. 预加载所有内容(Symfony 2 Preview 可以!).它会为您购买一些性能 cookie 并平衡速度基线.使用简单的预加载脚本并不难.

Zend Framework is a good framework but not very fast. Can you tell whether it's worth using Zend Framework for highload projects, for example, for email marketing service that can inlude about ten or houndred thousand of users? Is it possible to achive acceptable performance using Zend Framework? Has anybody such an expirience? Thank you very much.

解决方案

For what I have seen, the definitive defense of Zend Framework performance and recommendations for performance optimization comes from Padraic Brady at:

PHP Framework Benchmarks: Entertaining But Ultimately Useless

In particular, note his four recommendations for performance optimization:

  1. Don't use Zend_Application. While Zend_App is great for creating consistent complex bootstraps within a standardised structure, it doesn't come without a significant performance hit to baseline performance. A more direct bootstrap (typical of ZF until Zend_App arrived) is far faster and can also be done without configuration files.

  2. Skip using the ViewRenderer plugin. Without the ViewRenderer, you need to manually configure Zend_View and add render() calls to Controllers. This is actually very simple to do and is fairly fast - fast was never really part of the ViewRenderer's genetics.

  3. Use autoloading. Strip require_once calls from the framework library so unneeded files are ignored. Replace uses of Zend_Loader_Autoloader with a not-so-crazy autoloader function. In fact, pray Zend_Loader is never used - it does a lot of file ops that, to date, have never been explained to me as having any value.

  4. Preload everything (Symfony 2 Preview does!). It buys you some performance cookies and equalises the speed baseline. Using a simple preload script is not that hard.

这篇关于将 Zend Framework 用于高负载项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆