PHP Script timing out and MySql using almost all the CPU and RAM questions

Alex Dean alex at crackpot.org
Wed Jul 8 14:17:56 MST 2009


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20090708/185751a9/attachment.pgp 


More information about the PLUG-discuss mailing list