I/O rate and CPU Eating up Server making terribly slow site

central-processing-unitiolinodeswap

My server (Ubuntu 10.04 Lucid LAMP Stack) on linode (1024MB ram, 40 GB storage, 400 GB Transfer) is loading terribly slow. My site (WordPress) is relatively small (1.5 Gigs of mysql) and gets around 2k page view a day. I've seen guys running a site with 10x the traffic I have on a 512 mb ram and 20 gigs of storage + 200GB transfer. I really do not know what I am doing wrong, I've installed iotop and seen the results and it tells me that mysql uses a lot of the cpu. I have a cache system installed. Below are snapshots of the last 24 hrs. If you can tell me some suggestions it would really be resourceful.

See update below

enter image description here


Update:
Solved: Thank you all for your recommendations. I did instal mysqltuner and was able to see at depth what some of the problems were. I found out that the reason for the spike in io rate and swap was a wordpress plugin. The plugin was basically "processing" every minute and after I disabled it, things looked way better. Pic below

enter image description here

Best Answer

If you think this is due to MySQL, I would check the following things:

  • Run mysqltuner.pl, it will tell you where obvious problems with your MySQL installation are.
  • Activate and monitor the MySQL Slow Query Log, it will log all queries which take longer than N seconds to complete (where N is configurable). The queries might tell you if this issue is related to WordPress or something else. See the MySQL docs for more information.

Looking at the graphs, I'd also check if you can correlate the peak times with your access.log. Maybe you can see from the log if these requests are legitimate web requests.