You are right... there is not a whole lot to say without a more
information. For now, I'll assume we are talking about a pretty normal
LAMP server? Let's start with what is using 100% cpu? MySQL or PHP?
Also, the conditions you use. Any associations and so on...

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.

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?

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.



On Feb 12, 11:27 am, Paamayim <[email protected]> wrote:
> Hi.
>
> I've got a statement like this:
>
> $prev_article = $this->Article->find('first', array('conditions' =>
> $conditions, 'order' => array('Article.id' => 'ASC')));
>
> I know it's almost useless to tell you that, without knowing models,
> database structure, etc. I'm only asking from where I coud start to
> debug a behaviour that causes a 100% cpu usage on the server.
>
> In my local machine the find gets executed correctly, and I can dump
> the SQL statement. Copying that statement and executing it online from
> phpmyadmin, it gets executed correctly, without hangs of any sort.
>
> Any idea on how could I proceed?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to