Please explaining this Symfony2 vs ZendFramework 2 performance results
By default, the DoctrineORMModule
integration has no kind of caching active.
You have to set caching for your mappings in the configuration:
'doctrine' => [ 'driver' => [ 'orm_default' => [ 'class' => 'Doctrine\ORM\Mapping\Driver\DriverChain', 'drivers' => [], 'cache' => 'apc', ], ],],
The default cache is array
. Otherwise, parsing of annotations and any other kind of mappings will happen at each request.
Since I'm also maintainer of the ZF2-Doctrine2 integration, I may also be interested in finding out more about this topic. Do you have a test environment to show?
With proper caching of opcode (APC) and of DB requests (for example with Memcache), I would say that the difference between Synmfony and Zend will be peanuts.
Never choose a framework because of such a small perf difference. You'll gain much more perfs with caching and DB improvements that on the framework.
Unless you are building a finance real time app, or kinda, 10 or 20ms difference in response time is nothing. The average response time for a web page is usually in 100s of ms !
Also, converting a response time to a "number of requests per second" makes no sense, although I know this is common in PHP benchmarks. Because your Apache is not going to treat requests sequentially (one requests does not consume 100% CPU), 5 requests arriving at the same time will be served in less time than 5x the time for one request.
As Ocramius said, you should activate metadata cache:
$frontendOptions = array( 'lifetime' => 7200, // seconds 'automatic_serialization' => true ); $backendOptions = array( 'cache_dir' => APPLICATION_PATH_CACHE ); $this->cache = Zend_Cache::factory('Core', 'File',//Memcache is better $frontendOptions, $backendOptions); //ADD a metadata cache for DB, important for perf Zend_Db_Table_Abstract::setDefaultMetadataCache($this->cache);