I have a dedicated server with 4gb of ram and a Quad core Xeon cpu, serving a site with 350k pageviews a day using the wordpress script. The problem is, mysql is eating loads of cpu, and on investigation I found that it was handling 250 queries per second. This equates to 60 queries per page load, which cannot be correct. On top of this, most pages are cached using W3 Total Cache. I have several apps accessing the database, but how do I know which one is causing the high query usage?
feedback
|
|
MySQL has a statement called "show processlist" to show you the running queries on your MySQL server. | |||
feedback
|
|
For mysql issues setup slow queries log and do profiling using mysqltuner.pl and mysql tuning primer. This fixes most mysql problems. Analyze slow queires and check if you can add more indexes. Don;t forget to use innodb as engine and especially innodb buffer pool size variable. | |||||||
feedback
|
|
Why not go with something like WP Super Cache which will significantly reduce the amount of queries going to your database server? | |||||||
feedback
|
|
Enable slow query log and set the long_query_time variable. That will log all the queries which take more time than the specified time. Then use the mysqldumpslow tool to analyse the slow query log. For more information refer to the mysql documentation. | |||
|
feedback
|