Reputation: 4076
My site has just recently run into some issues with High CPU usage from MYSQL. When I check the Parallels Power Panel, it says that this: "/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/exa.example.com.pid --skip-external-locking" is using a high % of the CPU and the site becomes real slow.
I have checked every MySQL query on the entire site and there is nothing that should cause a long term problem like this. When I disable the routing file on the site, the load goes way down (almost 0%). As soon as it is turned back on, up to 100%. I came into work today to find that the server was down because of this.
The db has no more than 200,000 total records split up into 10 tables. I am starting to think that maybe the process(es) aren't finishing (hanging) or something else is wrong. You can load a page or two before the site comes to a stop.
What kind of ideas should I consider? I am somewhat of a newbie at configuring php and mysql so I haven't experimented with that too much yet.
UPDATE:
I've added this to the mysql config file:
log-slow-queries = log-slow-queries.log
long_query_time = 5
log-queries-not-using-indexes
Does that look okay? Of course, once I added that, the site seems to load a little better and the log file hasn't had anything written to it yet...
Upvotes: 0
Views: 1632
Reputation: 527378
Consider enabling and then examining the slow query log, to help you find problematic queries.
Also you say that you "checked every MySQL query" - how? Did you run EXPLAIN
plans for all of them? Sometimes queries can behave in ways that you don't expect.
Upvotes: 2