[email protected]
[Top] [All Lists]

Re: My App is Getting too Slow

Subject: Re: My App is Getting too Slow
From: Dérico Filho
Date: Wed, 7 Apr 2010 13:57:04 -0700 PDT
79 queries into a single database?

You see, there's this design flaw in CakePHP, in which it connects
into database as soon as the controller is instantiated. I am not sure
about other database drivers, BUT, in Mysql's, i.e. if you have 4
databases schemas, and you happen to use 4 models in a single
controller, each model connecting into a different database schema,
you'll end up having 4 database connections for _each_ request you got
in this controller - either you use the model object or not. 4
connections to 4 database schemas, even if they're in the same

Also take a look into the I/O resource used to connect into the
database, which turns out to be a bottleneck point. If webserver and
database are within the same host, consider using unix socket instead
TCP/IP connections, it'll help to reduce connection latency.

In my previous experience with such performance issues regarding DB, I
solved this problem of yours when I've hidden CakePHP of the
application. I mean, dinamically generating static pages with

For instance:
http://www.domain.com.br/customer/view/123.html is generated by

Dérico Filho

On Apr 6, 5:06 am, Ayman Bedair <ayma...@xxxxxxxxx> wrote:
> My CakePHP app is getting very slow... Although the debug give me
> "(default) 79 queries took 24 ms" the pages takes about 8 to 10
> seconds to load. Other script running on the same server are
> performing well, even empty pages on this same application is still
> loading good with all the App Controller functions running. Yet it is
> too slow in querying pages even if the autoRender is set to false. so
> it has nothing to do with the HTML and Images !! :(
> I thought it's with the mobile device detection I had there but that
> runs in the App Controller beforeFilter() function so it should be
> running on empty pages too !!!
> Is there a way i can debug that parts that makes all this delay ?!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 

To unsubscribe, reply using "remove me" as the subject.

<Prev in Thread] Current Thread [Next in Thread>