使用Zend Framework进行高负载项目

时间:2022-08-08 19:34:27

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.

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

6 个解决方案

#1


13  

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

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

PHP Framework Benchmarks: Entertaining But Ultimately Useless

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

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.

    不要使用Zend_Application。虽然Zend_App非常适合在标准化结构中创建一致的复杂引导,但它并没有在基线性能方面受到显着性能影响。更直接的引导程序(ZF的典型功能,直到Zend_App到达)要快得多,也可以在没有配置文件的情况下完成。

  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.

    使用ViewRenderer插件跳过。如果没有ViewRenderer,则需要手动配置Zend_View并向控制器添加render()调用。这实际上非常简单,并且相当快 - 快速从未真正成为ViewRenderer的遗传学的一部分。

  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.

    使用自动加载。从框架库中删除require_once调用,以便忽略不需要的文件。将Zend_Loader_Autoloader的使用替换为不那么疯狂的自动加载器功能。事实上,祈祷Zend_Loader永远不会被使用 - 它做了很多文件操作,到目前为止,从未向我解释过具有任何价值。

  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.

    预加载所有内容(Symfony 2预览版!)。它会为您购买一些性能cookie并使速度基线均衡。使用简单的预加载脚本并不难。

#2


7  

We've used ZF in a lot of high traffic sites, and we've had no issues so far. We did have to jump through a few low-hanging hoops, though.

我们在很多高流量网站上使用过ZF,到目前为止我们没有遇到任何问题。不过,我们确实必须跳过几个低悬的篮球圈。

Some suggestions:

一些建议:

  • use Zend_Queue to help with batch mailing
  • 使用Zend_Queue来帮助批量邮寄
  • use Zend_Cache whenever possible
  • 尽可能使用Zend_Cache
  • Use plugin loader cache
  • 使用插件加载器缓存
  • Strip require_once calls in favor of autoloading
  • 剥离require_once调用以支持自动加载
  • Get rid of components you don't want. (as suggested, you would not need MVC stack for CLI / mail)
  • 摆脱你不想要的组件。 (按照建议,您不需要用于CLI /邮件的MVC堆栈)
  • We chose Sphinx in favor of Zend_Search_Lucene (enormous performance gain)
  • 我们选择Sphinx而不是Zend_Search_Lucene(巨大的性能提升)

The bottom line for us has been this: development time is much, much more expensive than hardware. The flexiblity and higher re-use of code completely trumps any minor performance losses we had to deal with. For the most part, the performance overhead was very fixed.

对我们来说,最重要的是:开发时间远远超过硬件。灵活性和更高的代码重用率完全胜过我们必须处理的任何微小的性能损失。在大多数情况下,性能开销非常固定。

#3


4  

You ask:

你问:

Is it possible to achive acceptable performance using Zend Framework? Has anybody such an expirience?

是否有可能使用Zend Framework实现可接受的性能?有人有这样的经历吗?

Yes, I have experience with a site with millions of users. But you do need to use techniques to deal with the high load. Caching etc...

是的,我有一个拥有数百万用户的网站的经验。但是你确实需要使用技术来处理高负荷。缓存等...

A CDN can help a lot. Look into developing with the cloud. Amazon might be a pain to get started with but it helps you scale if need be.

CDN可以提供很多帮助。研究用云开发。亚马逊可能是一个痛苦的开始,但它可以帮助您扩展,如果需要。

I guess what I'm saying is, the Framework may cost you a bit of performance, but helps make maintenance possible and building it faster (once you get over the learning curve). Then you you have to evaluate what needs to be done to improve performance (although it helps a lot to plan for what will be obvious problems, right from the get go).

我想我所说的是,框架可能会花费你一些性能,但有助于使维护成为可能并更快地构建它(一旦你克服了学习曲线)。然后你必须评估需要做些什么来提高性能(尽管从一开始就有很多计划明显问题的方法)。

#4


2  

I know of several companies that use ZF in high-performance/high-load scenarios. I don't know which ones I can state and which ones I can't, but some of them are media companies who have to handle popular TV shows. Others handle live sporting events. Others are multi-billion dollar companies who need to serve their internal organizations. So, ZF is being used by plenty of companies who run pretty high-load sites. One of our case studies is Fox Interactive (http://framework.zend.com/about/casestudies) and I know of several other customers who use it for high-performance websites.

我知道有几家公司在高性能/高负载情况下使用ZF。我不知道哪些是我可以陈述的,哪些是我不能陈述的,但其中一些是必须处理热门电视节目的媒体公司。其他人处理现场体育赛事。其他是需要为其内部组织服务的价值数十亿美元的公司。因此,许多运行相当高负载站点的公司正在使用ZF。我们的一个案例研究是Fox Interactive(http://framework.zend.com/about/casestudies),我也知道其他几个将其用于高性能网站的客户。

Zend Framework MVC, out of the box, will be quite fast. My blog comes back in about 100ms without caching and there's a fair amount of stuff that happens on my front page. I could probably drop that down to 50ms with some internal caching (Full page caching could drop it down to single digit ms, but then it's not touching ZF).

Zend Framework MVC开箱即用,速度非常快。我的博客大约在100毫秒内没有缓存,而且我的头版上发生了大量的事情。我可以通过一些内部缓存将其降低到50ms(整页缓存可以将其降低到单个数字ms,但是它不会触及ZF)。

#5


2  

Seconding Joe's answer. I've also seen ZF deployed on a few sites handling millions of requests and have yet to encounter a problem. When dealing with that amount of traffic it's a good idea to use other strategies beyond your framework, including but not limited to caching and the use of a CDN.

借调乔的回答。我还看到ZF部署在处理数百万个请求的几个站点上,但还没有遇到问题。在处理该流量时,最好使用超出框架的其他策略,包括但不限于缓存和CDN的使用。

I've found most frameworks will call or create many class instances per request which I think is what causes people to say that framework X is slow without having any real world experience with it. Any hit you take there can be easily mitigated by using an accelerator and caching.

我发现大多数框架会为每个请求调用或创建许多类实例,我认为这是导致人们说框架X很慢而没有任何真实世界经验的原因。通过使用加速器和缓存,可以轻松减轻您在那里所遇到的任何打击。

If you already have a team of devs you've hired, I'd suggest using what they feel most comfortable with and have the most experience with. Best case they'll be able to tune their code for that framework.

如果你已经有一个你雇用的开发团队,我会建议他们使用他们最熟悉的并且拥有最丰富经验的人。最好的情况是,他们将能够调整该框架的代码。

#6


0  

A lot of the framework, any framework really, is used for building and managing the project development but the resulting project is 'just' php, html, css etc. the same as any other php web site. So what evidence do you have, that's real timing against other framework and non-framework built sites not anecdotal evidence, that a Zend project site is slow.

很多框架,任何框架确实用于构建和管理项目开发,但最终的项目是“只是”php,html,css等与任何其他php网站相同。那么你有什么证据,这是对其他框架和非框架建站点的真正时机,而不是轶事证据,Zend项目站点很慢。

Edit -- answers to below -- I don't think the structure that the framework uses will hurt performance. It may be more a question of PHP being acceptable and then how much 'overhead' is added with the site design and the optimisation of loading say JavaScript's etc. I would imagine that using the Yui guidelines of minifying JavaScript and CSS and loading them in the correct order and making sure the PHP code is efficient will help. You can also use other standard things such as DB Caching and Zend Accelerator will speed things up. One thing to be careful of would be the DB connection. The use of an ORM layer might have an impact.

编辑 - 下面的答案 - 我认为框架使用的结构不会影响性能。这可能更像是一个PHP被接受的问题,然后在网站设计和加载的优化中添加了多少“开销”,比如JavaScript等等。我会想象使用Yui准则来缩小JavaScript和CSS并将它们加载到正确的顺序并确保PHP代码有效将有所帮助。您还可以使用其他标准的东西,如DB Caching和Zend Accelerator,可以加快速度。要注意的一件事是数据库连接。使用ORM层可能会产生影响。

However back to the original question about the framework i think it is similar to asking if using Eclipse or Textmate has an effect on the speed of the resulting site.

然而,回到关于框架的原始问题,我认为它类似于询问使用Eclipse或Textmate是否会对结果网站的速度产生影响。

#1


13  

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

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

PHP Framework Benchmarks: Entertaining But Ultimately Useless

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

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.

    不要使用Zend_Application。虽然Zend_App非常适合在标准化结构中创建一致的复杂引导,但它并没有在基线性能方面受到显着性能影响。更直接的引导程序(ZF的典型功能,直到Zend_App到达)要快得多,也可以在没有配置文件的情况下完成。

  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.

    使用ViewRenderer插件跳过。如果没有ViewRenderer,则需要手动配置Zend_View并向控制器添加render()调用。这实际上非常简单,并且相当快 - 快速从未真正成为ViewRenderer的遗传学的一部分。

  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.

    使用自动加载。从框架库中删除require_once调用,以便忽略不需要的文件。将Zend_Loader_Autoloader的使用替换为不那么疯狂的自动加载器功能。事实上,祈祷Zend_Loader永远不会被使用 - 它做了很多文件操作,到目前为止,从未向我解释过具有任何价值。

  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.

    预加载所有内容(Symfony 2预览版!)。它会为您购买一些性能cookie并使速度基线均衡。使用简单的预加载脚本并不难。

#2


7  

We've used ZF in a lot of high traffic sites, and we've had no issues so far. We did have to jump through a few low-hanging hoops, though.

我们在很多高流量网站上使用过ZF,到目前为止我们没有遇到任何问题。不过,我们确实必须跳过几个低悬的篮球圈。

Some suggestions:

一些建议:

  • use Zend_Queue to help with batch mailing
  • 使用Zend_Queue来帮助批量邮寄
  • use Zend_Cache whenever possible
  • 尽可能使用Zend_Cache
  • Use plugin loader cache
  • 使用插件加载器缓存
  • Strip require_once calls in favor of autoloading
  • 剥离require_once调用以支持自动加载
  • Get rid of components you don't want. (as suggested, you would not need MVC stack for CLI / mail)
  • 摆脱你不想要的组件。 (按照建议,您不需要用于CLI /邮件的MVC堆栈)
  • We chose Sphinx in favor of Zend_Search_Lucene (enormous performance gain)
  • 我们选择Sphinx而不是Zend_Search_Lucene(巨大的性能提升)

The bottom line for us has been this: development time is much, much more expensive than hardware. The flexiblity and higher re-use of code completely trumps any minor performance losses we had to deal with. For the most part, the performance overhead was very fixed.

对我们来说,最重要的是:开发时间远远超过硬件。灵活性和更高的代码重用率完全胜过我们必须处理的任何微小的性能损失。在大多数情况下,性能开销非常固定。

#3


4  

You ask:

你问:

Is it possible to achive acceptable performance using Zend Framework? Has anybody such an expirience?

是否有可能使用Zend Framework实现可接受的性能?有人有这样的经历吗?

Yes, I have experience with a site with millions of users. But you do need to use techniques to deal with the high load. Caching etc...

是的,我有一个拥有数百万用户的网站的经验。但是你确实需要使用技术来处理高负荷。缓存等...

A CDN can help a lot. Look into developing with the cloud. Amazon might be a pain to get started with but it helps you scale if need be.

CDN可以提供很多帮助。研究用云开发。亚马逊可能是一个痛苦的开始,但它可以帮助您扩展,如果需要。

I guess what I'm saying is, the Framework may cost you a bit of performance, but helps make maintenance possible and building it faster (once you get over the learning curve). Then you you have to evaluate what needs to be done to improve performance (although it helps a lot to plan for what will be obvious problems, right from the get go).

我想我所说的是,框架可能会花费你一些性能,但有助于使维护成为可能并更快地构建它(一旦你克服了学习曲线)。然后你必须评估需要做些什么来提高性能(尽管从一开始就有很多计划明显问题的方法)。

#4


2  

I know of several companies that use ZF in high-performance/high-load scenarios. I don't know which ones I can state and which ones I can't, but some of them are media companies who have to handle popular TV shows. Others handle live sporting events. Others are multi-billion dollar companies who need to serve their internal organizations. So, ZF is being used by plenty of companies who run pretty high-load sites. One of our case studies is Fox Interactive (http://framework.zend.com/about/casestudies) and I know of several other customers who use it for high-performance websites.

我知道有几家公司在高性能/高负载情况下使用ZF。我不知道哪些是我可以陈述的,哪些是我不能陈述的,但其中一些是必须处理热门电视节目的媒体公司。其他人处理现场体育赛事。其他是需要为其内部组织服务的价值数十亿美元的公司。因此,许多运行相当高负载站点的公司正在使用ZF。我们的一个案例研究是Fox Interactive(http://framework.zend.com/about/casestudies),我也知道其他几个将其用于高性能网站的客户。

Zend Framework MVC, out of the box, will be quite fast. My blog comes back in about 100ms without caching and there's a fair amount of stuff that happens on my front page. I could probably drop that down to 50ms with some internal caching (Full page caching could drop it down to single digit ms, but then it's not touching ZF).

Zend Framework MVC开箱即用,速度非常快。我的博客大约在100毫秒内没有缓存,而且我的头版上发生了大量的事情。我可以通过一些内部缓存将其降低到50ms(整页缓存可以将其降低到单个数字ms,但是它不会触及ZF)。

#5


2  

Seconding Joe's answer. I've also seen ZF deployed on a few sites handling millions of requests and have yet to encounter a problem. When dealing with that amount of traffic it's a good idea to use other strategies beyond your framework, including but not limited to caching and the use of a CDN.

借调乔的回答。我还看到ZF部署在处理数百万个请求的几个站点上,但还没有遇到问题。在处理该流量时,最好使用超出框架的其他策略,包括但不限于缓存和CDN的使用。

I've found most frameworks will call or create many class instances per request which I think is what causes people to say that framework X is slow without having any real world experience with it. Any hit you take there can be easily mitigated by using an accelerator and caching.

我发现大多数框架会为每个请求调用或创建许多类实例,我认为这是导致人们说框架X很慢而没有任何真实世界经验的原因。通过使用加速器和缓存,可以轻松减轻您在那里所遇到的任何打击。

If you already have a team of devs you've hired, I'd suggest using what they feel most comfortable with and have the most experience with. Best case they'll be able to tune their code for that framework.

如果你已经有一个你雇用的开发团队,我会建议他们使用他们最熟悉的并且拥有最丰富经验的人。最好的情况是,他们将能够调整该框架的代码。

#6


0  

A lot of the framework, any framework really, is used for building and managing the project development but the resulting project is 'just' php, html, css etc. the same as any other php web site. So what evidence do you have, that's real timing against other framework and non-framework built sites not anecdotal evidence, that a Zend project site is slow.

很多框架,任何框架确实用于构建和管理项目开发,但最终的项目是“只是”php,html,css等与任何其他php网站相同。那么你有什么证据,这是对其他框架和非框架建站点的真正时机,而不是轶事证据,Zend项目站点很慢。

Edit -- answers to below -- I don't think the structure that the framework uses will hurt performance. It may be more a question of PHP being acceptable and then how much 'overhead' is added with the site design and the optimisation of loading say JavaScript's etc. I would imagine that using the Yui guidelines of minifying JavaScript and CSS and loading them in the correct order and making sure the PHP code is efficient will help. You can also use other standard things such as DB Caching and Zend Accelerator will speed things up. One thing to be careful of would be the DB connection. The use of an ORM layer might have an impact.

编辑 - 下面的答案 - 我认为框架使用的结构不会影响性能。这可能更像是一个PHP被接受的问题,然后在网站设计和加载的优化中添加了多少“开销”,比如JavaScript等等。我会想象使用Yui准则来缩小JavaScript和CSS并将它们加载到正确的顺序并确保PHP代码有效将有所帮助。您还可以使用其他标准的东西,如DB Caching和Zend Accelerator,可以加快速度。要注意的一件事是数据库连接。使用ORM层可能会产生影响。

However back to the original question about the framework i think it is similar to asking if using Eclipse or Textmate has an effect on the speed of the resulting site.

然而,回到关于框架的原始问题,我认为它类似于询问使用Eclipse或Textmate是否会对结果网站的速度产生影响。