The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Client hogging tons of CPU with WP - What to do?

Discussion in 'General Discussion' started by organic, Oct 27, 2010.

  1. organic

    organic Member

    Joined:
    Apr 26, 2009
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    I run a shared webhost, and we're having a particularly annoying problem with one of our clients, who is using a Wordpress plugin, or something related to Wordpress, that is hogging the CPU of the machine. Often times I will login, and find the user has upwards of four PHP processes which appear hung, that are taking up 20% of the CPU each. These processes don't seem to die, and so the server struggles along until I login, and killall php.

    Are there any suggestions from other admins on what to do here? I'm hesitant to ask the client to disable all plugins - I'd either like to restrict his CPU usage, or somehow debug the exact plugin that's causing the error. I can see it's index.php within the Wordpress directory, but that page controls almost all of Wordpress, and calls outside PHP plugins - One of these is the culprit. The site is not high volume - We're talking less than 50 visits a day.

    Any thoughts? What have other admins done in these cases - Spent time debugging, or just told the client to disable their plugins?

    Thanks, O
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I've seen a lot of high CPU usage WordPress sites, and the typical suggestion is to try to get the user to install a caching plugin to see if this cuts down on the CPU usage. The one I've most often suggested and seen the better results for would be the following one:

    WordPress › WP Super Cache « WordPress Plugins

    Thus, my suggestion is to get them to use a caching plugin if they aren't already (or to switch to this caching plugin instead if they are using a different one).
     
  3. VeZoZ

    VeZoZ Well-Known Member

    Joined:
    Dec 14, 2002
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    If all else fails you need to evaluate if they're worth hosting. If they are paying you $10/month and using $60/month worth of CPU they're probably not worth hosting if they're unable to resolve the CPU use.
     
  4. organic

    organic Member

    Joined:
    Apr 26, 2009
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the responses - Unfortunately they've paid for an entire year up front... ! But I think you're right, they're paying peanuts and hogging a ton of resources... It's not even worth my time to debug their installation and work it out...

    I've asked them to install wp-super-cache... So we'll see how it goes.

    Thanks again, O.
     
  5. InterServed

    InterServed Well-Known Member

    Joined:
    Jul 10, 2007
    Messages:
    255
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    DataCenter Provider
    I had same problems which made me develop a custom script that will identify such problems and automatically suspend such accounts for a defined time ( in my case 10 seconds ) and automatically unsuspend the account after defined time. This way all processes of that account will be recycled until they can fix their problems. The script can also email server administrator and customer (email auto taken from account info) with details of the identified problem such as number of processes and ram usage of all processes ( just need to continue to script to also calculate cpu usage ).
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Well, depending on the PHP handler, stuff such as RLimitCPU and RLimitMEM could be used in Apache's configuration (/usr/local/apache/conf/httpd.conf) to restrict to a set CPU and memory limit as well.

    There are also other scripts like prm that do something similar:

    Process Resource Monitor | R-fx Networks

    I also believe LFD in CSF has options to limit usage:

    ConfigServer Security & Firewall

    The issue with prm and LFD for doing this is that they kill off processes in a pretty hard state (a sigkill). I'm pretty certain that the rlimits simply restrict the usage without doing that type of kill and the rlimit settings work in conjunction with Apache.
     
  7. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    So, you can still suspend them. If they're hogging up the system, they need to work it out themselves.
    Sure it is, charge them to do it. Your job is to host their sites and everyone else's . If they want more then they need to pay more.

    WP is a known resource hog. Well, WP and poor plugins combined are. If the client wants to continue to run WP as it is, it's time to sell them a dedicated server so they can kill their own resources but not everyone else's
     
Loading...

Share This Page