So I'm using CakePHP for a couple of months now. The company I am
working at asked me to write a new web portal for them, so I thought,
"Well, Cake could make it!"
After spending some hours the website was (nearly) finished and so I
put it on the webspace the old webpage was at.
I already noticed during development that the site requests took about
3 - 5 secs until the page displayed, but I thought this is due to my
development environment (i just installed the XAMPP from apachefriends
with all default settings), but after uploading the website on the
host it got even worse.
Request times are between 4 to (up to!) 15 secs. Which is really ..
too slow for a business website. I also tried to cache a lot of
database requests so I limited most of the page calls to only 3 or 4
queries. But still load times are as high as they were before.
So there are some facts about my project: It is just a small
project ...
- Core
- 1 Model, 1 Controller, some views
- 5 Plugins: Often containing nothing more than a model and a
controller
- intended use: about 1000 visitors per month
So i don't have the faintest idea why cakePHP is running that slow?
I don't know which configuration settings to post and due to security
concerns I just don't want to publish the whole cake config or
phpinfo. But if any information is necessary needed please don't
hesitate to ask.
Have you indexed your foreign keys in your database properly? For our project that was a real performance boost!
Do you use requestAction a lot? I removed it nearly everywhere by now and have fat models instead.
Anja
-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von GeneSys
Gesendet: Dienstag, 16. Dezember 2008 15:10
An: CakePHP
Betreff: Very slow response times with CakePHP
Hey Folks!
So I'm using CakePHP for a couple of months now. The company I am working at asked me to write a new web portal for them, so I thought, "Well, Cake could make it!"
After spending some hours the website was (nearly) finished and so I put it on the webspace the old webpage was at.
I already noticed during development that the site requests took about
3 - 5 secs until the page displayed, but I thought this is due to my development environment (i just installed the XAMPP from apachefriends with all default settings), but after uploading the website on the host it got even worse.
Request times are between 4 to (up to!) 15 secs. Which is really ..
too slow for a business website. I also tried to cache a lot of database requests so I limited most of the page calls to only 3 or 4 queries. But still load times are as high as they were before.
So there are some facts about my project: It is just a small project ...
- Core
- 1 Model, 1 Controller, some views
- 5 Plugins: Often containing nothing more than a model and a controller
- intended use: about 1000 visitors per month
So i don't have the faintest idea why cakePHP is running that slow?
I don't know which configuration settings to post and due to security concerns I just don't want to publish the whole cake config or phpinfo. But if any information is necessary needed please don't hesitate to ask.
<anja.lieberm...@alltours.de> wrote:
> Hi GeneSys,
> Have you indexed your foreign keys in your database properly? For our project that was a real performance boost!
> Do you use requestAction a lot? I removed it nearly everywhere by now and have fat models instead.
> Anja
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von GeneSys
> Gesendet: Dienstag, 16. Dezember 2008 15:10
> An: CakePHP
> Betreff: Very slow response times with CakePHP
> Hey Folks!
> So I'm using CakePHP for a couple of months now. The company I am working at asked me to write a new web portal for them, so I thought, "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my development environment (i just installed the XAMPP from apachefriends with all default settings), but after uploading the website on the host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of database requests so I limited most of the page calls to only 3 or 4 queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security concerns I just don't want to publish the whole cake config or phpinfo. But if any information is necessary needed please don't hesitate to ask.
Thank you for your reply. I checked my database again and added a few
column indexes. Unfortunately that didn't have any impact on the
problem. I suppose the problem is not database related (all queries
summed up just take max. about 100ms on the webhost, and not more than
40ms on my dev-machine). Also I do not use requestAction.
Even after checking the most often called functions they won't use
more than 30ms. I just don't have the faintest idea where the
bottleneck may be :/
When you have an additional index on your foreign keys e.g. foo_id in your table kikis then your connecting datasets are found much faster.
In Mysql you do it like this:
ALTER TABLE `kikis` ADD INDEX (`foo_id`)
Hope that helps!
Anja
-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von Pyrite
Gesendet: Dienstag, 16. Dezember 2008 16:28
An: CakePHP
Betreff: Re: Very slow response times with CakePHP
How do you index foreign keys, what does that mean? I am using Postgresql. An example with MySQL will help too.
<anja.lieberm...@alltours.de> wrote:
> Hi GeneSys,
> Have you indexed your foreign keys in your database properly? For our project that was a real performance boost!
> Do you use requestAction a lot? I removed it nearly everywhere by now and have fat models instead.
> Anja
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im > Auftrag von GeneSys
> Gesendet: Dienstag, 16. Dezember 2008 15:10
> An: CakePHP
> Betreff: Very slow response times with CakePHP
> Hey Folks!
> So I'm using CakePHP for a couple of months now. The company I am working at asked me to write a new web portal for them, so I thought, "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my development environment (i just installed the XAMPP from apachefriends with all default settings), but after uploading the website on the host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of database requests so I limited most of the page calls to only 3 or 4 queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a > controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security concerns I just don't want to publish the whole cake config or phpinfo. But if any information is necessary needed please don't hesitate to ask.
> When you have an additional index on your foreign keys e.g. foo_id in your table kikis then your connecting datasets are found much faster.
> In Mysql you do it like this:
> ALTER TABLE `kikis` ADD INDEX (`foo_id`)
> Hope that helps!
> Anja
> -----Ursprüngliche Nachricht----- > Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von Pyrite > Gesendet: Dienstag, 16. Dezember 2008 16:28 > An: CakePHP > Betreff: Re: Very slow response times with CakePHP
> How do you index foreign keys, what does that mean? I am using Postgresql. An example with MySQL will help too.
> On Dec 16, 8:36 am, "Liebermann, Anja Carolin" > <anja.lieberm...@alltours.de> wrote: > > Hi GeneSys,
> > Have you indexed your foreign keys in your database properly? For our project that was a real performance boost! > > Do you use requestAction a lot? I removed it nearly everywhere by now and have fat models instead.
> > Anja
> > -----Ursprüngliche Nachricht----- > > Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im > > Auftrag von GeneSys > > Gesendet: Dienstag, 16. Dezember 2008 15:10 > > An: CakePHP > > Betreff: Very slow response times with CakePHP
> > Hey Folks!
> > So I'm using CakePHP for a couple of months now. The company I am working at asked me to write a new web portal for them, so I thought, "Well, Cake could make it!"
> > After spending some hours the website was (nearly) finished and so I put it on the webspace the old webpage was at.
> > I already noticed during development that the site requests took about > > 3 - 5 secs until the page displayed, but I thought this is due to my development environment (i just installed the XAMPP from apachefriends with all default settings), but after uploading the website on the host it got even worse.
> > Request times are between 4 to (up to!) 15 secs. Which is really .. > > too slow for a business website. I also tried to cache a lot of database requests so I limited most of the page calls to only 3 or 4 queries. But still load times are as high as they were before.
> > So there are some facts about my project: It is just a small project ... > > - Core > > - 1 Model, 1 Controller, some views > > - 5 Plugins: Often containing nothing more than a model and a > > controller > > - intended use: about 1000 visitors per month
> > So i don't have the faintest idea why cakePHP is running that slow?
> > I don't know which configuration settings to post and due to security concerns I just don't want to publish the whole cake config or phpinfo. But if any information is necessary needed please don't hesitate to ask.
So I investigated my application by use of XDebug and WinCacheGrind.
What made me really confusing is that bootstrap.php often takes ~350ms
to process. (comparison to another cake project of mine: 80ms).
In detail it shows me that the App::import Function in configure.php
called from bootstrap.php costs 230ms -- i wonder why?
Would it help someone if I'd loaded up the XDebug Cachegrind File?
> So I'm using CakePHP for a couple of months now. The company I am
> working at asked me to write a new web portal for them, so I thought,
> "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I
> put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my
> development environment (i just installed the XAMPP from apachefriends
> with all default settings), but after uploading the website on the
> host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of
> database requests so I limited most of the page calls to only 3 or 4
> queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small
> project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a
> controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security
> concerns I just don't want to publish the whole cake config or
> phpinfo. But if any information is necessary needed please don't
> hesitate to ask.
- Yes, tmp folders are world writable
- Debug is set to 0
- No, the slowdown is not a query problem
I'm not quite sure what you do mean by 'taxed server' => It is hosted
on a shared host.
What just makes me curious about is that the plain php website is
running quite fast and cakePHP is often more than 300% slower (e.g. =>
plain php site: 1.5 secs, cakephp: 5 - 6 secs)
A blank cakePHP Project (no controllers, no models, just the plain
framework) runs in about 1 sec -- so I'm not really convinced that it
is cake alone that makes the app so slow.
What I will do next is to add a blank controller and profile the
scripts by use of XDebug. Maybe I'm getting to the root of all evil
that way ;)
Thanks for your ideas Mark!
Bernhard
On Dec 17, 5:57 am, mark_story <mark.st...@gmail.com> wrote:
Hi Bernhard (GeneSys),
I found a really interesting stuff about cakePHP
performance tuning. If you read the post you would see that it´s
mentioned something about $html->link is slowing down the scripts. If
you are about to profiling your scripts maybe you could test that in
order to report it as a bug.
By the way, which version exactly are you working
with?
Hope that helps!
Federico
On Dec 17, 5:34 am, GeneSys <bernhard.bo...@gmail.com> wrote:
> - Yes, tmp folders are world writable
> - Debug is set to 0
> - No, the slowdown is not a query problem
> I'm not quite sure what you do mean by 'taxed server' => It is hosted
> on a shared host.
> What just makes me curious about is that the plain php website is
> running quite fast and cakePHP is often more than 300% slower (e.g. =>
> plain php site: 1.5 secs, cakephp: 5 - 6 secs)
> A blank cakePHP Project (no controllers, no models, just the plain
> framework) runs in about 1 sec -- so I'm not really convinced that it
> is cake alone that makes the app so slow.
> What I will do next is to add a blank controller and profile the
> scripts by use of XDebug. Maybe I'm getting to the root of all evil
> that way ;)
> Thanks for your ideas Mark!
> Bernhard
> On Dec 17, 5:57 am, mark_story <mark.st...@gmail.com> wrote:
> > Are the tmp folders world writable? is debug off? Is it on a taxed
> > server? Is the slowdown in the queries?
> So I'm using CakePHP for a couple of months now. The company I am
> working at asked me to write a new web portal for them, so I thought,
> "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I
> put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my
> development environment (i just installed the XAMPP from apachefriends
> with all default settings), but after uploading the website on the
> host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of
> database requests so I limited most of the page calls to only 3 or 4
> queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small
> project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a
> controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security
> concerns I just don't want to publish the whole cake config or
> phpinfo. But if any information is necessary needed please don't
> hesitate to ask.
> So I'm using CakePHP for a couple of months now. The company I am
> working at asked me to write a new web portal for them, so I thought,
> "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I
> put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my
> development environment (i just installed the XAMPP from apachefriends
> with all default settings), but after uploading the website on the
> host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of
> database requests so I limited most of the page calls to only 3 or 4
> queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small
> project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a
> controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security
> concerns I just don't want to publish the whole cake config or
> phpinfo. But if any information is necessary needed please don't
> hesitate to ask.
What is this X-CMS header? Are you running some sort of CMS in the
same host?
Perhaps there could be some sort of conflict of this CMS and the
CakePHP...
On Dec 16, 9:09 am, GeneSys <bernhard.bo...@gmail.com> wrote:
> So I'm using CakePHP for a couple of months now. The company I am
> working at asked me to write a new web portal for them, so I thought,
> "Well, Cake could make it!"
> After spending some hours the website was (nearly) finished and so I
> put it on the webspace the old webpage was at.
> I already noticed during development that the site requests took about
> 3 - 5 secs until the page displayed, but I thought this is due to my
> development environment (i just installed the XAMPP from apachefriends
> with all default settings), but after uploading the website on the
> host it got even worse.
> Request times are between 4 to (up to!) 15 secs. Which is really ..
> too slow for a business website. I also tried to cache a lot of
> database requests so I limited most of the page calls to only 3 or 4
> queries. But still load times are as high as they were before.
> So there are some facts about my project: It is just a small
> project ...
> - Core
> - 1 Model, 1 Controller, some views
> - 5 Plugins: Often containing nothing more than a model and a
> controller
> - intended use: about 1000 visitors per month
> So i don't have the faintest idea why cakePHP is running that slow?
> I don't know which configuration settings to post and due to security
> concerns I just don't want to publish the whole cake config or
> phpinfo. But if any information is necessary needed please don't
> hesitate to ask.
By taxed server I meant a heavily loaded server. Sometimes on shared
servers your processes are limited and database response times can be
slow. If you are getting really slow load on entirely static pages
that could point to something else though. Perhaps limitations in
processing power or slow disks.
-Mark
On Dec 17, 5:34 am, GeneSys <bernhard.bo...@gmail.com> wrote:
> - Yes, tmp folders are world writable
> - Debug is set to 0
> - No, the slowdown is not a query problem
> I'm not quite sure what you do mean by 'taxed server' => It is hosted
> on a shared host.
> What just makes me curious about is that the plain php website is
> running quite fast and cakePHP is often more than 300% slower (e.g. =>
> plain php site: 1.5 secs, cakephp: 5 - 6 secs)
> A blank cakePHP Project (no controllers, no models, just the plain
> framework) runs in about 1 sec -- so I'm not really convinced that it
> is cake alone that makes the app so slow.
> What I will do next is to add a blank controller and profile the
> scripts by use of XDebug. Maybe I'm getting to the root of all evil
> that way ;)
> Thanks for your ideas Mark!
> Bernhard
> On Dec 17, 5:57 am, mark_story <mark.st...@gmail.com> wrote:
> > Are the tmp folders world writable? is debug off? Is it on a taxed
> > server? Is the slowdown in the queries?
The X-CMS header is just a header I send every time a page is served
-- so no (other) CMS is running in background or some sort of thing --
CakePHP is the CMS ;) ..
I use XDebug only on my local development-machine -- online
(eurolyser.com) there is no debugger installed (just good old PHP5
with Zend Optimizer)
The L10n is done in my AppController ...
switch($selected_language)
{
case 'de': Configure::write('Config.language','deu');
break;
default:
case 'en': Configure::write('Config.language','eng');
break;
}
every localized output is then done with __() -- anything that seems
to slow down the performance considerable?
Thank you for your ideas Dérico!
@Federico
Oh my gosh ... $html->link is slowing down the scripts? I use that
nearly everywhere on my pages (I extended the class so it changes the
language of the links automatically) -- but do you really think that
may be the problem? I used $html->link() on earlier projects without
having any problems -- but i will check that, thanks for the
Information!
I used CakePHP 1.2 RC1 and RC3 => Seems to make no difference
according to the response times.
At the Moment I use 1.2 RC1 -- is RC3 the better choice? (I haven't
tested the website with RC3 enough so I kept RC1 running)
Hi Bernhard,
I am sorry, I have no straight answer for what is slowing your site
down and can only offer suggestions of where to keep investigating.
I think you were on to something a few posts back when you stated that
XDebug reported your botstrap slow and more specifically App::import
(). In your shoes I would keep profiling to see where time is lost. If
you are lucky you will find something specific.
Since you can't install debugging on the production server I would do
it the "bad old way":
Manually put timers on anything you can in a clean CakePHP (to start
with). If you time the index.php, bootstrap, app_controller and a few
other things you can think of you have a "baseline". If you then do
the same for your app you can begin to see where time is lost.
One thing to check that I have noticed as a great bottleneck in my
code is data manipulation. Your SQL was not exactly slow but 100ms of
SQL can result in a few thousand rows of data that can bring php to
its knees when Cake tries to arrange the data into arrays for you.
Your portal does not look like it contains 10'000 articles at the
moment but take a look at the returned counts in the SQL debug.
Anything above 500 rows should be looked at to see if the data slows
down rendering or some manipulation (Set::extract(), afterFind()...).
Also in your last post you mention RC1. This version is supposed to be
quite a bit slower than RC3, but 5 sec sound way too slow.
Sorry for only offering more suggestions of random things to check.
/Martin
On Dec 16, 6:43 pm, GeneSys <bernhard.bo...@gmail.com> wrote:
> Additional infos after debugging with XDebug ...
> So I investigated my application by use of XDebug and WinCacheGrind.
> What made me really confusing is that bootstrap.php often takes ~350ms
> to process. (comparison to another cake project of mine: 80ms).
> In detail it shows me that the App::import Function in configure.php
> called from bootstrap.php costs 230ms -- i wonder why?
> Would it help someone if I'd loaded up the XDebug Cachegrind File?
Thank you for your constructive input! SQL seems not to be the
problem, because pages that don't require any SQL query run as slow as
pages that require some. (Also the amount of affected rows is often
not more than just a couple of)
Following your advice I did 'benchmark' the application and found out
a really 'strange' thing ...
In /cake/libs/configure.php on line 929 there is the following code-
line ...(called during bootstrap)
// Measurement point added by me ... [folder_before]
$directories = $Folder->tree($path, false, 'dir');
// Measurement point added by me ... [folder_after]
At the last iteration it takes up about 1.5 - 2 seconds in average to
parse(!) (which is approximately 50%-60% of the whole processing
time!!) (all iterations before take up only about 10ms) (the complete
processing time was about 3.2 seconds)
The $path variable helds the value of CAKE_CORE_INCLUDE_PATH/cake in
the last iteration
On my webhost PHP Safe mode is activated. Could this cause any issues
on folder access times? Maybe one who is more familiar with the core
of the framework could tell why the LAST iteration (containing the
path to /CAKE_CORE_INCLUDE_PATH/cake) takes up that long?
So I think if that issue could be resolved processing times would
decrease to about 1 - 2 seconds which would be as nearly as fast as
the (old) plain PHP site.
It seems something for _Nate_ to take a look... :-)
Perhaps there's something to do with PHP Safe mode ou some sort of
hardened PHP plugin which controls and avoids recursion.
This Folder->dir method uses recursion to create the file tree
structure for CakePHP internals. One last check you could do is to run
this software with debug 0 on some other PHP server, but a known Safe-
mode-free server. This would be the final check.
If it works just fine in the other server, then you've found a bug
likely.
Are you able to do such a test?
Thanks,
Dérico Filho
On Dec 17, 9:53 pm, GeneSys <bernhard.bo...@gmail.com> wrote:
> Thank you for your constructive input! SQL seems not to be the
> problem, because pages that don't require any SQL query run as slow as
> pages that require some. (Also the amount of affected rows is often
> not more than just a couple of)
> Following your advice I did 'benchmark' the application and found out
> a really 'strange' thing ...
> In /cake/libs/configure.php on line 929 there is the following code-
> line ...(called during bootstrap)
> // Measurement point added by me ... [folder_before]
> $directories = $Folder->tree($path, false, 'dir');
> // Measurement point added by me ... [folder_after]
> At the last iteration it takes up about 1.5 - 2 seconds in average to
> parse(!) (which is approximately 50%-60% of the whole processing
> time!!) (all iterations before take up only about 10ms) (the complete
> processing time was about 3.2 seconds)
> The $path variable helds the value of CAKE_CORE_INCLUDE_PATH/cake in
> the last iteration
> On my webhost PHP Safe mode is activated. Could this cause any issues
> on folder access times? Maybe one who is more familiar with the core
> of the framework could tell why the LAST iteration (containing the
> path to /CAKE_CORE_INCLUDE_PATH/cake) takes up that long?
> So I think if that issue could be resolved processing times would
> decrease to about 1 - 2 seconds which would be as nearly as fast as
> the (old) plain PHP site.
So, i've been experiencing some time problem too on a cakephp based
portal.
I have seen that with debug setted to 0 the speed increases a few..
but
it's still to slow..
I also enabled caching on each requestAction (1 day) but nothing
changed;
the overall database time is quite small (40msec) but the whole page
loading
takes about 500msec on my own MacBook Pro .. but 4-5 seconds on the
server
that hosts the site ..with 1 connection only.
No i'll try to put timers everywhere.. and will see what's happening.
I hope to have some explaination from one of the cake guys.
bye,
Andrea
On Dec 18, 2:09 pm, Dérico Filho <uldericofi...@gmail.com> wrote:
> It seems something for _Nate_ to take a look... :-)
> Perhaps there's something to do with PHP Safe mode ou some sort of
> hardened PHP plugin which controls and avoids recursion.
> This Folder->dir method uses recursion to create the file tree
> structure for CakePHP internals. One last check you could do is to run
> this software with debug 0 on some other PHP server, but a known Safe-
> mode-free server. This would be the final check.
> If it works just fine in the other server, then you've found a bug
> likely.
> Are you able to do such a test?
> Thanks,
> Dérico Filho
> On Dec 17, 9:53 pm, GeneSys <bernhard.bo...@gmail.com> wrote:
> > Hallo Martin,
> > Thank you for your constructive input! SQL seems not to be the
> > problem, because pages that don't require any SQL query run as slow as
> > pages that require some. (Also the amount of affected rows is often
> > not more than just a couple of)
> > Following your advice I did 'benchmark' the application and found out
> > a really 'strange' thing ...
> > In /cake/libs/configure.php on line 929 there is the following code-
> > line ...(called during bootstrap)
> > // Measurement point added by me ... [folder_before]
> > $directories = $Folder->tree($path, false, 'dir');
> > // Measurement point added by me ... [folder_after]
> > At the last iteration it takes up about 1.5 - 2 seconds in average to
> > parse(!) (which is approximately 50%-60% of the whole processing
> > time!!) (all iterations before take up only about 10ms) (the complete
> > processing time was about 3.2 seconds)
> > The $path variable helds the value of CAKE_CORE_INCLUDE_PATH/cake in
> > the last iteration
> > On my webhost PHP Safe mode is activated. Could this cause any issues
> > on folder access times? Maybe one who is more familiar with the core
> > of the framework could tell why the LAST iteration (containing the
> > path to /CAKE_CORE_INCLUDE_PATH/cake) takes up that long?
> > So I think if that issue could be resolved processing times would
> > decrease to about 1 - 2 seconds which would be as nearly as fast as
> > the (old) plain PHP site.
> > Thank you all for helping me with that issue :)
> I also enabled caching on each requestAction (1 day) but nothing > changed;
are you sure the cache's are being written? look in /tmp/cache/views for $this->element caches, and /tmp/cache/models for things written in the model with Cache::write
> the overall database time is quite small (40msec) but the whole page > loading > takes about 500msec on my own MacBook Pro .. but 4-5 seconds on the > server > that hosts the site ..with 1 connection only.
A MBP doing nothing else is a pretty beefy server, so to give a better idea of the comparison, what hardware are you deploying on? Can you increase the memory allocated to php via php.ini or .htaccess? Most of my projects have a 64mb+ limit set.
Hi Jon
i didn't checked if cache is actually being written..
if it doesn't happens what could be the problem?
As far as the deployment, i know that a MBP doing nothing else is
a perfect server.. but in my opinion its 500 ms are still too much.
I have switched to cakephp after almost 1 year passed on building/
extending
my own framework, because i found it very easy and well done
mine had many design problems a probably many efficiency problems..
but it only used to take 150 ms on the same MBP ..70% off of the time
cakephp takes..
Anyway the html->link fact is worrying me, maybe i should convert all
those calls to direct URLs ..or at least do not use the array Url
format
('controller'=>'posts','action'=>'view',34) but /posts/view/34 .
thanks,
Andrea
On Dec 18, 3:30 pm, "Jon Bennett" <jmbenn...@gmail.com> wrote:
> > I also enabled caching on each requestAction (1 day) but nothing
> > changed;
> are you sure the cache's are being written? look in /tmp/cache/views
> for $this->element caches, and /tmp/cache/models for things written in
> the model with Cache::write
> > the overall database time is quite small (40msec) but the whole page
> > loading
> > takes about 500msec on my own MacBook Pro .. but 4-5 seconds on the
> > server
> > that hosts the site ..with 1 connection only.
> A MBP doing nothing else is a pretty beefy server, so to give a better
> idea of the comparison, what hardware are you deploying on? Can you
> increase the memory allocated to php via php.ini or .htaccess? Most of
> my projects have a 64mb+ limit set.
> Hi Jon
> i didn't checked if cache is actually being written..
> if it doesn't happens what could be the problem?
> As far as the deployment, i know that a MBP doing nothing else is
> a perfect server.. but in my opinion its 500 ms are still too much.
> I have switched to cakephp after almost 1 year passed on building/
> extending
> my own framework, because i found it very easy and well done
> mine had many design problems a probably many efficiency problems..
> but it only used to take 150 ms on the same MBP ..70% off of the time
> cakephp takes..
> Anyway the html->link fact is worrying me, maybe i should convert all
> those calls to direct URLs ..or at least do not use the array Url
> format
> ('controller'=>'posts','action'=>'view',34) but /posts/view/34 .
Where is this 'fact'? 1/2s in production mode I also consider too
slow ;)
The 1.5 - 2 seconds seems really wierd - maybe something to with the
file system on the server ( - particularly with safe mode enabled?)
For example I think Dreamhost have their shared servers on NFS - and
vaguely remember something about a cache plugin for wordpress that
even said that you shouldn't use it on NFS as it would actually slow
things down. (sorry can't remember the details)
On Dec 17, 11:53 pm, GeneSys <bernhard.bo...@gmail.com> wrote:
> Thank you for your constructive input! SQL seems not to be the
> problem, because pages that don't require any SQL query run as slow as
> pages that require some. (Also the amount of affected rows is often
> not more than just a couple of)
> Following your advice I did 'benchmark' the application and found out
> a really 'strange' thing ...
> In /cake/libs/configure.php on line 929 there is the following code-
> line ...(called during bootstrap)
> // Measurement point added by me ... [folder_before]
> $directories = $Folder->tree($path, false, 'dir');
> // Measurement point added by me ... [folder_after]
> At the last iteration it takes up about 1.5 - 2 seconds in average to
> parse(!) (which is approximately 50%-60% of the whole processing
> time!!) (all iterations before take up only about 10ms) (the complete
> processing time was about 3.2 seconds)
> The $path variable helds the value of CAKE_CORE_INCLUDE_PATH/cake in
> the last iteration
> On my webhost PHP Safe mode is activated. Could this cause any issues
> on folder access times? Maybe one who is more familiar with the core
> of the framework could tell why the LAST iteration (containing the
> path to /CAKE_CORE_INCLUDE_PATH/cake) takes up that long?
> So I think if that issue could be resolved processing times would
> decrease to about 1 - 2 seconds which would be as nearly as fast as
> the (old) plain PHP site.
Thanks to everyone who has helped in this issue so far.
So this issue got me a bit restless ;) Did some testing on my
development server and on the 'production' machine.
Cake Framework used: RC3
On my development server I figured out the following behavior ...
* When calling a page the folder structure (for the cake framework) in
the bootstrap part gets read. The last iteration costs huge more time
than any other iteration (time varies between ~5ms up to ~200ms per
iteration, last iteration takes ~2000ms) --- when in debug 0 mode, the
folder structure seems to get cached when refreshing the page often.
(Anyone outside who knows how to control how long _that_ cache is
valid, or how to control how to enable that caching feature?)
* Complete bootstrap takes about 3000ms (2800ms are "wasted" by the
step I described before)
* The main application (measurement points before and after the
dispatcher) costs about 800ms
Summarization: A page request costs nearly 4 secs without the
directory tree cached and < 1 sec when cached.
System: Dell Inspiron 1720, OS: Windows Vista, CPU: T7300 (2.00GHz),
RAM: 2GB; XAMPP 1.6.7 beta1 (Apache: 2.2.9 / PHP: 5.2.6 / mySQL:
5.0.51b); (running local)
Remarks: PHP safe mode is not enabled
On my production server occures the following behavior ...
* First step: Same behavior as on the development server but times
vary by ~2ms up to ~250ms per iteration, last iterations takes
~2500ms. When in debug mode 0 folder structure won't get cached (am I
doing anything wrong here? On the development server (using same
configuration) caching works? (FYI: Yes, tmp folder is world-writeable
and "models"/"persistent" subfolders exist))
* Complete bootstrap costs ~3500ms, ~3200ms are used for the directory
tree iterations.
* Main application costs ~600ms.
Summarization: A page request costs also about 4 secs, but the
directory tree won't get cached. (This would increase performance
dramatically I guess ;))
System: Hardware facts unknown (as are the stats how many hosts are
shared on the same server). Webserver is: Apache 2.0.59, PHP: 5.2.5.
OS: Linux compatible (distro unknown)
Remarks: PHP safe mode is enabled
I hope I'll have some time the next few days and try to upload the
application on a dedicated server where I can repeat those tests for
comparison with my dev and my (current) production environment.
So I'm not quite sure if it's PHPs safe mode which decreases cakes
performance so signifcantly or if there's any other issue that is
involved in there. Caching the folder structure in production mode
(debug 0) would improve the performance (by not loosing any RAD
philosophy by cake) a lot -- any ideas how to accomplish this (a
solution within using the tools cake provides would fit best I think)?