ZF2 Optimize for high traffic

后端 未结 5 675
清酒与你
清酒与你 2020-12-12 15:17

My ZF2 application seems to be extremely slow when more than 3 users are using it at the same time.

I profile my code with xdebug and webgrind and non of my function

5条回答
  •  清歌不尽
    2020-12-12 16:01

    If you are using Doctrine, don't forget to add a cache for annotations. This drastically improve performance (when I activate this cache I divide nearly by two the loading time). If you are using DoctrineORMModule:

    'doctrine' => array(
        'driver' => array(
    
            'cache' => array(
                'class' => 'Doctrine\Common\Cache\ApcCache'
            ),
    
            'configuration' => array(
                'orm_default' => array(
                    'metadata_cache' => 'apc',
                    'query_cache'    => 'apc',
                    'result_cache'   => 'apc'
                )
            ),
        )
    )
    

    However, it's quite inconvenient while developing because you must clear the cache whenever your mapping change.

提交回复
热议问题