Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Try using top to make sure that it is indeed WordPress (probably listed under your webserver process) hogging your resources. –  Chris Kuehl May 6 '12 at 2:40
    
Please don't update your question to provide the answer, but write an answer describing the solution and accept it as soon as possible. –  glglgl May 6 '12 at 22:30
add comment

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks for your input, see my update. –  andrewk May 6 '12 at 19:58
add comment

Looking at the network load, I'm guessing that there are burst of activity, is that from your users/ customers or elsewhere? Maybe something to look at.

Also - how is your MySQL database organized - 1.5Gb can in some cases be a large database... Indexes and Optimization scripts in place?

I am taking a stab-guess at the usual causes of problems like this of course, does your installation have anything out of the ordinary that could be causing this load? Wordpress Plugins, Cron jobs, etc?

I should say that it is very possible that this is simply a non-Wordpress related issue - automatic update cron jobs, etc?

share|improve this answer
    
Thanks for your input, see my update. –  andrewk May 6 '12 at 19:57
add comment

Looking at your graphs there, it looks very periodic. You don't have any cron jobs or "scheduled tasks" inside Wordpress do you? Running once every second hour like clock work from the looks of things.

To analyze your Wordpress you can install X-Debug to perform profiling and see where the bottle neck lies (a long processing PHP / MySQL queries will show here and give you a great start).

You can also enable MySQL's Slow Query Log as Oliver suggested

EDIT: Also it looks like your getting massive amounts of traffic at certain times, it could be Crawlers (think Google), or someone attacking your server (or even just people like going to your site way more at certain times....). You should look at your access logs during these peak times.

You can view all of the systems cronjobs with the following command (run as root):

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
share|improve this answer
    
Thanks for your input, see my update. –  andrewk May 6 '12 at 19:58
    
Instead of updating the question you should post it as an answer and mark it as such, or mark Oliver's answer as the answer (as he suggested to do what you've done) –  Mattisdada May 7 '12 at 3:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.