DB Server Load Problem

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.
 
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.
 
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.
 
Back
Top