Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Zend Framework for highload projects

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.

like image 422
Oleg Avatar asked Sep 23 '10 11:09

Oleg


2 Answers

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.

like image 197
David Weinraub Avatar answered Oct 27 '22 00:10

David Weinraub


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.

Some suggestions:

  • use Zend_Queue to help with batch mailing
  • use Zend_Cache whenever possible
  • Use plugin loader cache
  • Strip require_once calls in favor of autoloading
  • Get rid of components you don't want. (as suggested, you would not need MVC stack for CLI / mail)
  • We chose Sphinx in favor of Zend_Search_Lucene (enormous performance gain)

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.

like image 40
Adrian Schneider Avatar answered Oct 26 '22 23:10

Adrian Schneider