Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please explaining this Symfony2 vs ZendFramework 2 performance results

We are benchmarking Symfony2 with Doctrine2 vs. ZendFramework2 with Doctrine2.

The test consisted in a bare ZF2 and SF2 Hello World for baseline Vs. the same but with Doctrine2 loading a simple object. We used ab and measured only the requests per second and time per request.

During the bare framework test Hello World ZF2 performed much better than SF2 almost 2x as better.

However when we did the same test but adding Doctrine2 into the mix the results were inverted. SF2+D2 behaved 2x fast as ZF2+D2.

We have skills in-house for both Symfony2 and for ZendFramework so we could go for either or, and we are not concerner about RAM usage as we can always get more RAM. But we do care about performance and we need helping the best tool.

Some ideas: - We believe S2 is doing some sort of caching - We believe ZF2 Doctrine2 ORM Module might be the cause - We are unsure as to what type of caching to use in production? APC?Xcache? etc.

Framework + Doctrine loading an object      
Concurrent:100 / Connections: 1000      
    Resp. T ms  Req. Sec
ZF2        60   16
S2         31   32

Framework + Doctrine loading an object      
Concurrent: 25 / Connections: 150       
    Resp. T ms  Req. Sec
ZF2         57  17
S2          30  32


======================

Framework Bare      
Concurrent: 100 / Connections: 1000     
    Resp. T ms  Req. Sec
ZF2         10.5    94
S2          15.3    65.36       

Framework Bare      
Concurrent: 25 / Connections: 150       
    Resp. T ms  Req. Sec
ZF2         10  98
S2          15.4    64
like image 423
smorhaim Avatar asked Nov 30 '12 23:11

smorhaim


1 Answers

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?

like image 61
Ocramius Avatar answered Sep 22 '22 19:09

Ocramius