CakePHP 1.3:CPU使用率高 [英] CakePHP 1.3: High CPU Usage

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

问题描述

我有一个在共享主机帐户上运行的CakePHP应用程序,提供程序已经向我很多(A2HOSTING),我的帐户过度使用CPU资源,有时是100%。

I have a CakePHP application that is running on a shared hosting account, which the provider has been bugging me a lot (A2HOSTING) that my account is excessively using CPU resources, sometimes 100%.

就在最后几个小时,CPanel报告CPU使用率高。我已经与他们说话,他们说一切都指向webroot目录。我只有 index.php css.php

Just on the last few hours alone, CPanel is reporting high CPU Usage. I have spoken with them and they said that everything is pointing to the 'webroot' directory. There I only have index.php and css.php.

任何想法,可能导致此问题的原因,以及我可以如何解决问题,因为他们正在威胁暂停我的帐户。

Any ideas, what can be causing this issue, and what can I do to fix it, as they are threatening to suspend my account.

感谢,

推荐答案

没有一个很多说没有更多的
信息。现在,让我们从什么是使用100%cpu开始? MySQL还是PHP?
此外,您使用的条件。任何关联等等...

There is not a whole lot to say without a more information. For now, Let's start with what is using 100% cpu? MySQL or PHP? Also, the conditions you use. Any associations and so on...

如果一切都在你的本地设置上正常工作,那么我将开始寻找
在它和你的服务器之间的任何差异。
CakePHP,PHP,MySQL的版本是不同的?服务器
是否运行了其中一个的臭名昭着的版本?

If it all works ok on your local setup then I would start by looking at any differences between that and your server. Versions of CakePHP, PHP, MySQL... are they different? Is the server running some infamous version of one of them?

让我们指责数据库:
数据库结构和数据真的完全相同?每一个细节都仔细看看

你有相同的内容吗?究竟?克隆您的开发数据库
,包括所有表的定义和数据。

Let's blame the database: Is the database structure and data really identical, really? Look carefully as every detail. Do you have the same content in them? Exactly? Clone your dev database including all table definitions and data.

有时我注意到一个逻辑的失效,一个干净的
数据库会导致问题,因为我在
整个开发期间有数据,并且由于某种原因,我错过了
(看起来不相关)将失败,如果表是空的。

Sometimes I notice a lapse of logic on my part where a "clean" database will cause problems because I have had data in it during the whole development and for some reason I have missed that something (seemingly unrelated) will fail if a table is empty.

让我们归咎于PHP:
当PHP最终以100%cpu结束时,问题通常是它在某处停留在
。你有一条靠近那条线吗?
如果你让请求运行,你只是得到一个超时或从
内存?

Let's blame PHP: When PHP ends up at 100% cpu, the problem is usually that it is stuck in a loop somewhere. Do you have one near that line? If you let the request run, do you just get a timeout or an out of memory?

查找第一应该永远不会导致内存不足,除非您的
服务器
有200'000个相关记录被加载。请尝试指定递归-1。
即:从任何其他表中绝对不加载任何东西。

Finding "first" should never result in out of memory unless your server has 200'000 related records being loaded. Try specifying recursive -1. That is: load absolutely nothing from any other table.

参考资料: https://groups.google.com/forum/?fromgroups#!topic/cake-php/lS91s355_Pw

此帖子可能会帮助您以减少CPU过载。

This post might help you to decrease the CPU overload.

这篇关于CakePHP 1.3:CPU使用率高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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