# DB Server Load Problem



## shesjustaglitch (Feb 6, 2012)

Anyone can help me. What can I do to trace that causes spike on CPU load, because I don't find anything on my slow queries log and mysql error logs. Sometimes when I'm observing while using the *top* command the load averages from 0.20-0.50 but when I'm not watching, the server will email me when the load reaches the warning 2.xx. Anyone can help me how to trace it?

mysql server is seperate from my apache server.


----------



## fluca1978 (Feb 6, 2012)

First thing I would do is to enable the tracing of *all* queries, so that you can see what the server (or better, the database) was doing when the system alerted you. This will help you finding if the problem is about the database or not.


----------



## shesjustaglitch (Feb 6, 2012)

Yes I do that, but still when I check on the queries, all of them are fine when I test the queries 
They are fast to execute.


----------



## fluca1978 (Feb 7, 2012)

Please note I did not suggest you to test the queries, but to log the queries and match them against the time of the alert. When you execute a query and then re-execute it later chances are the query will go faster due to cache (disk, database, ...). 

You can also use other tools, like iostat, vmstat, and so on, to monitor your system while running and see if there is an I/O problem (database) or not.

If you have already done this, and the query logs are fine, then the problem is not in the database.


----------



## SirDice (Feb 7, 2012)

You can also run a MySQL tuning script to see if it's configured properly. It might be running out of cache or use way too much.

http://www.day32.com/MySQL/


----------

