Discover Centmin Mod today
Register Now

Wordpress High Nginx Cpu usage

Discussion in 'Blogs & CMS usage' started by julliuz, Jan 30, 2019.

  1. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    8:30 PM
    1.15
    hey !

    We just fully switched to centminmod, its incredible so far, seems very solid.

    Anyhow, we have the same traffic as before we switched (from EE) , about 120-150k people a day.

    Problem is that, while sql and php processes seem to be doing a lot better than before, nginx (2cpu cores/2worker processes) each take 25% continuously while it was always close to nothing before (5-10% cpu max)


    Its serving tons of images.

    Running standard 22 cache enabler wordpress setup.

    Any ideas ? I noticed a shitton of nginx config files that weren't "around" before. Might anything trigger high nginx cpu usage ?

    Thank you :)
     
  2. Jimmy

    Jimmy Well-Known Member

    1,799
    391
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +999
    Local Time:
    2:30 PM
  3. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    4:30 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Exact same server used as EE or different specs ?

    It's quite possible that Centmin Mod would use more cpu and memory as it's configured to handle more load and thus use more resources (that's how performance works usually). But it's also possible that traffic patterns and make up of that traffic aren't exactly the same as prior on EE as they are now with Centmin Mod.

    FYI, CPU load optimal is 1.0 per cpu thread so 8 cpu thread normal = 8x1 = 8.0. 16 cpu server normal is 16x1 = 16.0

    so cpu load of 8 for
    • 2 cpu server = 8/2 = 4.0 load average
    • 4 cpu server = 8/4 = 2.0 load average
    • 8 cpu server = 8/8 = 1.0 load average
    When you type top command, hit number 1 to break down per cpu stats

    Centmin Mod is provided as is, so troubleshooting load issues is left to end user to do. However, there's many linux tools and scripts that can help you figure out what was causing the load issues and when.

    If you're providing info on this forum, more info might be helpful
    1. What version of Centmin Mod ? .08 stable or .09 beta ? If .09 beta when was it installed and when was last time you updated ?
    2. What's your VPS/Server hardware specifications ? cpu type ? memory available ? disk space ?
    3. Who's your web host ? Different hosts have different limits for server resource usage and some are more restrictive that others so it could just be their resource usage policy you tripped which may or may not be restrictive. If restrictive, then real solution would be finding a better web host. If not restrictive, then it's finding out what caused high cpu load.
    4. If running Centmin Mod 123.09beta01 or higher, you will have access to a cminfo top command which can also provide a summary of statistics - some of which are explained in info and linked articles below.
    Tools and commands you will want to read up on and learn for basic system admin tasks and troubleshooting.
    Notes:
    For example what's output for these commands
    Code (Text):
    top -bn1
    

    Code (Text):
    ps aufxw
    

    Code (Text):
    sar -q
    

    Code (Text):
    sar -r
    

    Code (Text):
    sar -q -f /var/log/sa/sa$(date +%d -d yesterday)
    

    Code (Text):
    sar -r -f /var/log/sa/sa$(date +%d -d yesterday)
    

    If you want to look at per process usage stats use pidstat run pidstat every 1 sec for 5 runs and sed is just to replace your main hostname with word hostname so mask your domain for posting on public places
    Code (Text):
    pidstat -durh 1 5 | sed -e "s|$(hostname)|hostname|g"
    

    for posting code you might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    4:30 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    also how are you measuring the cpu usage on EE and Centmin Mod ?
     
  5. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    8:30 PM
    1.15
    I'm so sorry for thinking centmin had anything to do with it, been investigating and trying stuff all day.

    Turns out it was a plugins settings that reset when I moved and it enabled a view counter for every visit on every image view. Resulting in tens of thousands of admin-ajax requests... Absolutely stupid but its fixed now. I found out by following your ngxtop guide, it was showing that shit on top, everything is smooth sailing now, the load went to 2 while prime time is on (1500 people online, 500 pageviews a minute) , everything is super super fast. Thank you so much and sorry for wasting your time :)
     
  6. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    4:30 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Ah ngxtop can be a life saver. Glad to hear you got to the bottom of the issue :)
     
  7. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    8:30 PM
    1.15
    While this topic is open, I had only 1 question left:
    There is an automatic database maintenance going on every day, its happening at 5-ish pm my time, any way to change the time this happens ?
     
  8. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    4:30 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    nope no automatic database cronjobs are setup by Centmin Mod - you can check your cronjobs to see what runs