使用插件会减慢CakePHP [英] Using plugins slows down CakePHP

查看:207
本文介绍了使用插件会减慢CakePHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CakePHP的7-8插件,网页需要3到6秒来加载。为什么插件会减慢CakePHP这么多? O_O。
我发现它是慢的,因为它加载模型在插件(我禁用Cake的全局缓存)
(我使用localhost开发网站,调试级别= 2)

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)

使用DebugKit,我发现组件初始化和启动需要3s-> 6s,但是我无法解决问题。

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' );(我全局禁用Cake的缓存,禁用缓存检查和Cache.disable = true)

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

时间加载更改从1s - > 4s只有1行加载插件行为
2插件代码由核心团队cakePHP我不认为在插件。

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.

推荐答案

您可以拥有数百个不执行任何操作并且完全不加载网页的插件。或者你可以只有一个插件做很多,或者不好,并有页面加载超时。

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.

因此,你需要在低级别上配置你的应用程序(例如 http://www.xdebug.org/docs/profiler ),或者您需要逐个切换插件看看哪一个是罪魁祸首。

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.

这篇关于使用插件会减慢CakePHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆