Re: PHP Script timing out and MySql using almost all the CPU…

Top Page
Attachments:
Message as email
+ (text/plain)
+ PGP.sig (application/pgp-signature)
+ (text/plain)
Delete this message
Reply to this message
Author: Alex Dean
Date:  
To: Main PLUG discussion list
Subject: Re: PHP Script timing out and MySql using almost all the CPU and RAM questions
MySQL using 99% of CPU running a massive query doesn't sound unusual.
If that's killing your production app, look into setting up a
replication slave, and point your reporting queries at the slave.
It's not too hard to set up.
http://dev.mysql.com/doc/refman/5.0/en/replication.html

On Jul 8, 2009, at 2:21 PM, keith smith wrote:

>
> 1) What could cause the MySql server to start using so much CPU?
> After a restart we ran the report again and the CPU usage was much
> less. The report still timed out.


Have you tried EXPLAIN on your query? That will help you spot where
it could be optimized.
http://dev.mysql.com/doc/refman/5.0/en/explain.html

>
> 3) The report we were running gave no indication of timing out. I'm
> wondering how the following PHP.ini directives come into play:
>
> - max_execution_time = 30 : In seconds. Why would the script appear
> to keep working?


That only limits PHP's execution time. Time spent waiting for
external resources (like mysql) don't count against that limit.
http://us3.php.net/manual/en/info.configuration.php#ini.max-execution-time

>
> - max_input_time = 60 : Same question as above.


I think that's the time you'll allow PHP to accept input from the
user. Usually only comes into play with large file uploads, I think.
(Hazier on this one, though...)
http://us3.php.net/manual/en/info.configuration.php#ini.max-input-time

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss