desiguru

Well-Known Member
Aug 27, 2008
73
0
56
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.
 

lijeeshsd

Active Member
Apr 22, 2005
33
0
156
Hello,

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

desiguru

Well-Known Member
Aug 27, 2008
73
0
56
Hello,

Have you checked memory and other usage? It is possible that your server is running out of memory frequently.
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>
 

ramindia

Well-Known Member
Apr 3, 2011
71
0
56
try reducing the

Timeout 30

try changing keepalive on
and keepalive time 10

and restart
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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.
 

desiguru

Well-Known Member
Aug 27, 2008
73
0
56
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.
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?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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