Discover Centmin Mod today
Register Now

Nginx high cpu usage - Big static file server

Discussion in 'Other Web Apps usage' started by julliuz, Dec 24, 2018.

  1. julliuz

    julliuz New Member

    25
    2
    3
    Dec 20, 2018
    Ratings:
    +5
    Local Time:
    10:46 AM
    1.15
    Maybe you have an idea @eva2000

    So I came from easy engine and nginx was basically installed on a tiny slice with unmetered bandwidth. 1/4th cpu and 1gig ram and it did its thing just fine! The load was never above 0.1 serving 100+ mp4 files between 20 and 150mb in size.

    Since starting a server with option 2 (simple nginx vhost) and dumping all the files in de folder, the cpu usage is through the roof causing major buffering and slow ttfb for the clips to load.

    Is this caused by all the nginx modules that are loaded in the background (and not needed for this project ?)

    If so, can I disable all of them or do I go for another way so serve these files ?

    Thank you!
     
  2. eva2000

    eva2000 Administrator Staff Member

    42,393
    9,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,752
    Local Time:
    7:46 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Might need some troubleshooting to see where the load is coming from. Also pay attention to cpu steal time (top reported as %st time and sar -u command reports it as %steal time - used by other neighbouring VPS users on same VPS host node).
    Code (Text):
               us, user    : time running un-niced user processes
               sy, system  : time running kernel processes
               ni, nice    : time running niced user processes
               id, idle    : time spent in the kernel idle handler
               wa, IO-wait : time waiting for I/O completion
               hi : time spent servicing hardware interrupts
               si : time spent servicing software interrupts
               st : time stolen from this vm by the hypervisor
    

    Is this same VPS used for Easyengine with Ubuntu just reloaded with CentOS and Centmin Mod, or did you get a new VPS with same web host to install CentOS/Centmin Mod ? As you could of gotten on a VPS host node which is busier and have higher cpu steal time unlike your previous Easyengine VPS server.

    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 :)