These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Ridicoulusly High CPU Usage From MySQL on the new forum.
MySQL is slowing down my whole server, it stops page from starting there loading and uses up to over 90% of the CPU at random spikes. I can't do anything like import, repair, optimize etc. mySQL databases. It only crashes and results in a 500 internal server error.
Howdy,
You may want to run "top" to see what all is at the top of your resource usage.
But, if it really is MySQL -- you'd need to look into what applications are running that are causing MySQL to use so many resources.
If you log into MySQL as root from the command line (with "mysql -u root -p", you can run "show full processlist" to get a list of what queries are currently running in MySQL.
You can use that to determine which applications are causing the issues.
-Eric
Ok, well yes it's the process "mysqld" using very large amounts of CPU at spike.
Since I have an IPB forum with 300,000 posts and the DB is about 200mb I thought it might be that. I've tried repairing and optimizing all of my databases so I'll see if that helps and also try this.
Also, it seems awstats is doing the same thing. It's coming up and hitting 100% CPU at random times.
I disabled Awstats and the optimizing and repairing of the DBs seemed to bring the MySQL CPU usage down but still sometimes when I go to a page on my site the load takes 10 seconds or so to begin, once it begins it's fast and the next page loads are fast until I have another 10 second before load. This is the output I get running the mySQL tuning script.
Howdy,
For any of your Virtual Servers with the awstats feature enabled -- there's an entry in cron for them to run stats collections once a day. That stats collection can be resource intensive -- using Webalizar rather than awstats can lower your resource usage.
You're welcome to attempt tuning MySQL. Generally though, when you're getting as poor performance as you're seeing -- there's a deeper problem than can be solved with just tuning. You may need to spend some time getting a better feel for the specific problem that's occurring.
The "mytop" program can show you what's going on inside MySQL, it's one way that you can troubleshoot things.
-Eric
Do you think it could be do to the fact that I have a lot of sites that mostly sit idle? So the processes have to start up on the first page load?
This is what it looks like when it happens: http://i44.tinypic.com/5ed990.png This is what it looks like when I test it again right after: http://gyazo.com/241af4cb046d57c9f6244d92c2c9a49d.png
I don't think your issues are related to having idle sites, or too many sites.
I think, in order to troubleshoot this issue, that you need to use tools like top and mytop in order to determine what processes, and within MySQL, what queries, are causing the problems you're seeing.
You can also use "uptime" to see your system load, and "free -m" to see your used/available RAM.
-Eric
I get command not found for mytop and I tried logging into my mySQL server but I just get an arrow when I run that command.
You'd need to install the "mytop" program, it's not installed onto most Linux distros by default.
When you type MySQL commands, they should end with a semicolon... so that command should look like this:
show full processlist;
I found a fix which has worked 100%. I added a value to my my.cnf with the following line:
wait_timeout = 1800
No more random slow downs, system runs 100% smoothly now.