Re: MySQL to blame? (was Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



M5 wrote:

On 20-Dec-07, at 1:17 AM, Per Jessen wrote:

René Fournier wrote:

I'm really not sure what to try next. ps -aux shows MySQL as hogging
the CPU, not PHP or Terminal:

When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's
doing.

I have, and I can't see anything unusual. There are a few scripts that loop with very slow overhead (with sufficient sleep(), etc.) plus a few outside HTTP requests. Nothing unusual.

Incidentally, yesterday, when MySQL went to 80-90% again after a week, I let it stay there while I poked around MySQL (doing the above) and the OS to see if there are some magical limit that I might be breaking. So it the server ran with MySQL at 80-90% CPU for about eight hours. Everything still worked fine, scripts ran, the database was available. That's the thing about this problem--it's not a show-stopper, it's just really strange. And I can't figure its source.

Check your mysql logs for just before this time and see if there are any queries there that need attention.

Do you have the slow-queries log enabled? Also make sure you have the option to log queries that don't use an index turned on. See if anything there gives you some clues.

Are you committing a big transaction (thousands of records or something)? Or do you have a transaction idling and not committing or rolling back?

Are you replicating data to another server and this is triggering the problem? Or a backup is running?

It doesn't shutdown. Finally--and I really hate doing this, because it sees dangerous to data (is it?)--I issue a kill -9 command to its process.

I'd say it's very dangerous to do that to a database but ask the mysql list, they will have better insight into what this does.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux