MySQL Disk IO Writes – How to Identify Causes

MySQL

I have a Ubuntu 14.04 server running half a dozen wordpress sites. Total traffic to the server is on the order of 30k page views a day.

Over the past couple months, with page views and network traffic roughly flat, my disk I/O has been trending up significantly. It has doubled over the past month. When I run iotop, I can see that mysqld (v. 5.5) is constantly writing to disk at a rate of around 5MB per minute. I can't think of anything happening on any of the sites that would generate so much writing.

I have spent a lot of time reading mysql tuning tutorials and adjusting variables (mostly to do with tmp table size, and query cache parameters) and nothing I have tried has made any difference. My current guess is that there is probably a bad query in one of the wordpress plugins in use. But there are a lot of plugins spread over half a dozen wordpress installs and I don't know where to look.

Is there some way that I can pinpoint what exactly is causing mysqld to be writing to the disk so much?

UPDATE : This question was explored in better detail and answered thoroughly here.

Best Answer

Take a look at the mysql processlist. mysql -p -e "show processlist". Or even a "show full processlist". It will give you a list of currently running queries.