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.

Server goes down a lot lately

Discussion in 'General Discussion' started by desiguru, Apr 24, 2011.

  1. desiguru

    desiguru Well-Known Member

    Joined:
    Aug 27, 2008
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    My server goes down a lot lately. I can't figureout why.

    It happens almost once a day and then I have to manually reboot it.
     
  2. lijeeshsd

    lijeeshsd Active Member

    Joined:
    Apr 22, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    Have you checked memory and other usage? It is possible that your server is running out of memory frequently.
     
  3. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello,

    Keep on monitoring the server at the time it goes down ! Then you will be able find which user, backup or service is causing the issue.
     
  4. desiguru

    desiguru Well-Known Member

    Joined:
    Aug 27, 2008
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    Actually that's exactly what happens.

    Here is my httpd.conf

    Code:
    
    
    Timeout 300
    TraceEnable Off
    ServerSignature Off
    ServerTokens ProductOnly
    FileETag None
    <IfModule prefork.c>
    StartServers       800
    MinSpareServers    80
    MaxSpareServers   240
    ServerLimit      5120
    MaxClients       5120
    MaxRequestsPerChild  20000
    </IfModule>
    
    
    
     
  5. ramindia

    ramindia Well-Known Member

    Joined:
    Apr 3, 2011
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    try reducing the

    Timeout 30

    try changing keepalive on
    and keepalive time 10

    and restart
     
  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
    You can try installing a system monitoring utility that will log processes and memory along with other variables every minute. When the server goes down, you can then check those logs to see what was running right before the server crashed.

    The script is called sys-snap.sh and here are the steps to install it:

    Code:
    cd ~
    wget http://sys-snap.techfiles.us/
    chmod +x sys-snap.sh
    nohup ~/sys-snap.sh &
    At that point, the ~/system-snapshot folder will be created and you can do "cd ~/system-snapshot/" to go into that folder. You'll be able to view the logs there and can tell based on the timestamps for each file (viewable by doing "ls -lah ~/system-snapshot/") to see what was running right before the server crash.

    Of note, sys-snap.sh will quit running when the server goes offline. This means that you'll need to restart it after you finish reviewing the logs to have it run again for the next server crash. The command to start it will always be "nohup ~/sys-snap.sh &" to ensure it runs without having to detach a window.
     
  7. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello Tristan,

    It is really a new info. Thanks for that !
     
  8. desiguru

    desiguru Well-Known Member

    Joined:
    Aug 27, 2008
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    I think I already know what happens, my httpd connections are not closing properly can you suggest some different values then what Im already using in httpd.conf?
     
  9. 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
    You would probably want to enable KeepAlive to on, and set a KeepAliveTimeout as well.

    You would likely want to decrease these values:

    ServerLimit 5120
    MaxClients 5120

    Those are 10x higher than the normal values of 512. If you have such serious activity that you require 5120 connections for Apache simultaneously, you likely would want to go off of Apache entirely and switch to either LiteSpeed, nginx or Cherokee for static connections.

    Also, when you state the machine is going down, is it actually going down where it becomes inaccessible, or is it simply Apache is hanging in a browser? If you can access the machine via root SSH and httpd is running but only sites aren't loading, then you are either getting a DoS attack or reaching the maximum connections. Given the high value you have for MaxClients, if your machine is reaching MaxClients without it being an attack, the server simply has too much traffic for Apache to handle at that point.

    I did a post that provides guidelines on how to troubleshoot a possible DoS attack:

    http://forums.cpanel.net/f5/how-restart-apache-trough-cpanel-command-line-187252.html#post766101
     
Loading...

Share This Page