Help!! Mysql is causing heavy server load

Discussion in 'MySQL' started by Dr-AMG, Jul 18, 2009.

  1. #1
    Hi, I'm facing a serious problem since 2 days ago regarding mysql database
    my site is on a shared host and is not busy at all(max 4000 visits a day) but as of thursday I got suspended due to heavy resource usage, of course I managed to get my site running again, but the problem persists,
    Now this is my problem: my server load which must be 1 or 2 is staying within 5 to 10 :( when I type 'top' in shell I see that lots of php,httpd and mysqld processes are running, mysql user agent specifically sits at top and occasionally hits 200% cpu load :O
    I've disabled almost all of my plugins (it's a wordpress site) and adjusted my php files as mush as possible, nevertheless, this damn server load stays high!
    I know there are some experts here, please help me, how can I find out what part of the SQL is causing this issue??????
     
    Dr-AMG, Jul 18, 2009 IP
  2. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #2
    A link to the site would be helpful. Before doing so, make sure these function calls are in your footer please:

    http://lastblogger.com/archives/339

    That's the problem right there. Wordpress is very heavy pulling resources out of MySQL. One site I saw, it was doing well over 200 requests for each and every page load.

    Please take a look at the wp-super-cache plugin as a solution:

    http://wordpress.org/extend/plugins/wp-super-cache/

    You may want to try google'ing for 'wordpress very heavy server load' as this is a common problem.

    It's one of the reasons I moved to MT. Sure it takes a few minutes to complete rebuild a site or under a minute to publish a post but then it's no load what so ever until I do something again to the site. Very light on the site.

    Hope this helps,
    -drmike
     
    theapparatus, Jul 18, 2009 IP
  3. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks mike for your help,
    I actually installed supercache though I'm not sure it won't cause trouble to my search targeted advertisements!!
    Anyway, I've also shaved quit a lot of weight off my database by deleting unnecessary(at least by my opinion!) tables, It's a bit better now, but still seems like a script or something is keeping the server busy, and I can't find it.

    I think the best solution would be to move to a VPS, specially as the traffic is growing so I eventually will have to,
    whatdaya think? will VPS be trouble free in this sense??
     
    Dr-AMG, Jul 18, 2009 IP
  4. adithya

    adithya Well-Known Member

    Messages:
    568
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #4
    @theapparatus: Thanks for the link ... i have added those lines in every of my wordpress site now :D

    @Dr-AMG: Even i faced the same problem .. see even if u disable the plugins things like "Latest Posts" ," Recent Comments","Popular Posts" etc will cause queries too ..
    See whether u can disable a few .. and also see whether u can replace common tags like <?php bloginfo('url'); ?> etc with the actual ones ...

    And set the expiry time in Super Cache to 7200 sec i.e, 2 hrs
     
    adithya, Jul 19, 2009 IP
  5. crumblepie

    crumblepie Well-Known Member

    Messages:
    2,612
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    160
    #5
    Instead of deleting all these nice features, I think upgrading to a VPS is a better option. You're probably going to need it eventually, so you may as well do it before making unnecessary changes to the site.
     
    crumblepie, Jul 19, 2009 IP
  6. Cebu Real Estate

    Cebu Real Estate Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I do refer you transfer to VPS, even if you user super cache still it will eat up a bit and depends on visitors pageviews or you just did call all the crawlers of SE
     
    Cebu Real Estate, Jul 19, 2009 IP
  7. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hey guys,
    thank ya'll for advises
    weirdly supercache plugin just caused more server load !!!! it even hit 16 (8cpu) last night :O so is diabled it, this problem is really strange, i have made all the other adjustment including replacing theme tags, but still mysqld process keep using 700% + cpu!
    I.m now removing current database and installing my recent backup to see if it helps
    BUT, I'm really thinking about moving to a good VPS, I dont wanna ruin my site by disabling features
    I'm considering EuroVPS since they are cheap and look reliable, please share your advises regarding this case...
    Thanks
     
    Dr-AMG, Jul 19, 2009 IP
  8. gary4gar

    gary4gar Peon

    Messages:
    496
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #8
    EuroVPS as name suggests are located in europe and are a reliable company.any reason for european location?

    Also, do your full research before choosing a provider
     
    gary4gar, Jul 19, 2009 IP
  9. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    @gary4gar
    No actually my only reason for considering EuroVPS is their cheap price (14 euros/month) for the basic plan which seems to cover my needs for now :D
    most of my traffic is from US, will it affect the traffic if I move server to Europe??
     
    Dr-AMG, Jul 19, 2009 IP
  10. gary4gar

    gary4gar Peon

    Messages:
    496
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    If most of your traffic is from US then its not smartest thing to move to Europe. because latency would increase. further you can find providers catering to your price point in US also.

    So I recommend a provider with US based location as most of your visitor base is from US, the site would be loading faster
     
    gary4gar, Jul 19, 2009 IP
  11. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You make sense Gary, I will search for US based providers,
    with this level of server load, I'm gonna get banned on my shared host again sooner or later! so I gotta be quick,
    I checked the one in your signature, price is good, but since I'm a noob! I didn't get it if that plan is sufficient for a heavy wordpress site with visitor around 5k a day (I guess it'll get to 10k in a couple month with daily 30k pageviews)??????
    any recommendation is much appreciated
     
    Dr-AMG, Jul 20, 2009 IP
  12. RHS-Chris

    RHS-Chris Well-Known Member

    Messages:
    1,007
    Likes Received:
    35
    Best Answers:
    10
    Trophy Points:
    150
    #12
    If this is a shared host, are you sure that you are the one causing the high server loads? The processes you see through the top command are for the entire server, not just your account. It may be that another account is causing the loads to spike. The server admin should also be looking at optimizing mysql on the system itself.
     
    RHS-Chris, Jul 20, 2009 IP
  13. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Really , I didn't know that! apart form the top, the number I see in front of server load in my cpanel, is that also for the whole server or that is just me??
    BTW, today it hit 42.5 :D
     
    Dr-AMG, Jul 21, 2009 IP
  14. Webmaster Perks

    Webmaster Perks Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    A good solution is a VPS. Then you can install the memcached daemon and the PHP Memcache client. Then there is a WP cache script you can simply download and you're done.

    Using that solution my page view queries dropped from over 80 to just 6.

    If shared hosts could/would offer a memcached service for their clients they'd save everyone the frustration of heavy loads and non-responsive WP installations.
     
    Webmaster Perks, Jul 21, 2009 IP
  15. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #15
    That's the wp-super-cache plugin mentioned up above.
     
    theapparatus, Jul 21, 2009 IP
  16. RHS-Chris

    RHS-Chris Well-Known Member

    Messages:
    1,007
    Likes Received:
    35
    Best Answers:
    10
    Trophy Points:
    150
    #16
    That would be the whole server, not just your account.
     
    RHS-Chris, Jul 21, 2009 IP
  17. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #17
    If you have direct access to MySQL on the server, just watch it with the "show full processlist" command and see what specific queries are wrecking it...
     
    digitalpoint, Jul 21, 2009 IP
  18. Dr-AMG

    Dr-AMG Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Problem is I have minimum access possible! I cannot even view my.cnf,
    Now that I realized that server load is for the whole thing and not just my account it's a bit of relief, after all I reduced the size of mysql from 172 to 42 MB and made some other adjustments that you guys suggested and I'm very thankful for, (only super cache plugin didn't work properly as it increased the load immediately once activated) so if the host picked on me again I will fire back with complaints about their server:rolleyes:(and then they will shut me down!! hehe)
    I believe VPS is the ultimate solution here mainly for the freedom it gives adjusting things, I'm looking for a good company, one that last forever and I wouldn't have to change it in a year or so
    If are happy with your VPS provider (price,reliability,support, etc..) please tell me about it, (or PM me if it's not right to post here)
    Many many thanks
     
    Dr-AMG, Jul 21, 2009 IP
  19. gary4gar

    gary4gar Peon

    Messages:
    496
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #19
    For starting, decide. you need a managed or unmanaged VPS.

    Managed is when hosts helps you with software issues.
    Unmanaged - you are on your own
     
    gary4gar, Jul 21, 2009 IP
  20. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #20
    Well make a PHP script or something that just does the query "show full processlist" and then spits out the output for you... that's one way of seeing what processes are going on.
     
    digitalpoint, Jul 21, 2009 IP