views:

85

answers:

1

I am using 7-8 plugins with CakePHP, and the webpage takes from 3 to 6s to load . Why do plugins slow down CakePHP so much? O_O. I found out it is slow because it loads model in plugins (I disabled Cake's cache globally) (I use localhost to develop the website, Debug level = 2)

Using DebugKit, I found out Component initialization and startup takes 3s->6s, but I can't solve the problem.


i disabled all plugins and ONLY in model i add line

var $acts = array('Search.searchable','Tags.Tagged');(I disabled Cake's cache globally, disabled cache check and Cache.disable = true)

time load change from 1s -> 4s only with 1 line load Behavior in plugins 2 plugin code by core team cakePHP i dont think matter in plugin.

A: 

You can have hundreds of plugins that don't do anything and have the page load in no time at all. Or you can have only one plugin that does a lot, or does it poorly, and have the page load time out. It's really not about the number, it's about what each plugin is doing.

As such, you either need to profile your app on a low level (e.g. http://www.xdebug.org/docs/profiler) or you need to switch plugins off one by one to see which one is the culprit.

deceze
i disabled all plugins and ONLY in model i add var $acts = array('Search.searchable','Tags.Tagged');time load change from 1s -> 4s only with 1 line load Behavior in plugins
meotimdihia
@meotim By adding "only one line", you're causing dozens, hundreds, maybe thousands of lines of code to execute in the added Behaviors. Again: **The number is not important, it's important what these plugins do!** Apparently `Search.searchable` and/or `Tags.Tagged` simple **do a lot of stuff**. I don't know either (and you haven't specified what plugin exactly they are), so I can't comment on them.
deceze
I use plugin of cakeDC and my plugin . I sure is it dont do a lot of stuff but my plugin and cakeDC cause slow together. I tested it slow when bindModel in plugins.model .ex:
meotimdihia
@meotim Okay, so it seems you've narrowed down the cause of the problem to some possible interaction between the two. Now you just need to figure out why the two together are slow.
deceze
ex: if in Behavior setup:ex: $Model->bindModel(array('hasAndBelongsToMany' => array( 'Tag' => array( 'className' =>'Tags.Tagged'))); It slow even only have a $acts = array('Search.serachable'); if a more than it slower.
meotimdihia