Apache loads up the server.. help!

CooLMaN

Verified User
Joined
Mar 9, 2004
Messages
13
Hey guys,
i got my new Dual P3 800MHz + 512MB ram server ( with DA installed and FC1 ).

I recompiled apache ( using da script ), and also installed ZEND ( thought it seems like dosent do anything ), also installed mod_gzip ( and verified its working ), but server loads go often to 15 and when i check its says httpd uses 99% cpu.. and i got very low memory when apache is running .

here is my httpd important lines:
Timeout 300
KeepAlive off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 8
MaxClients 300
MaxRequestsPerChild 0


please tell me what to add/remove/fix.

thank you all,
gil.
 
Hello,

I'm not too sure.. it could be a rogue cgi script, or a bad compile. Check the username that is being used for the apache process that is eating up your cpu. If it's apache, then it might be a php script, if it's a DA user, it might be a cgi (although cgi's are run on their own). If it's running as root, then it's the parent process going nuts, so a clean rebuild might be needed. Not sure that it would be the problem, but it's something to try:
Code:
cd /usr/local/directadmin/customapache
[b]./build clean[/b]
./build all
/sbin/service httpd restart
John
 
thank you John,
My dc says i need more ram, thought its way too expensive.

Can you give me a good httpd.conf configurations?



Thanks!
gil.
 
Timeout 300
KeepAlive on
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 8
MaxClients 300
MaxRequestsPerChild 10000

The only real performance increase would be the "KeepAlive on". It allows multiple requests to be made through the same apache connection. The MaxRequestsPerChild can be 0, I just like to set it to a high number so that the child process is restarted every now and then in case there are any memory leaks (not too likely)

John
 
CooLMaN said:
My dc says i need more ram, thought its way too expensive.
Half a gig of RAM should be enough, but I've never felt RAM to be too expensive considering the benefits.

Our system minimum installs are now 1 gig of RAM.

Jeff
 
Take into account that this can be a simple case of shitty PHP programming..

See in top if it's httpd loading up your server, and if so, what you can do to find the problem site is the following:

ps aux | grep httpd
see if there's a shitload of httpd/apache processes running..., look at their PID's and the time that they were started, this is a good starting point.., note these 2 things down

Now it's time for the tedious part.., log digging..

First look in /var/log/httpd/suexec_log, and look the time up, and see if some weird scripts got executed.., if not, time to dig the user logs..

Since it's usually PHP which causes this, we can already narrow it down to only PHP scripts at those minutes the bunch of httpd processes were running as..

Example:
cd /var/log/httpd/domains
grep "12/Jul/2004:15:28" * | grep php | less

This line will display every entry from July 12th on 15:28 with the word php in it.., it's still a shitty job to find WHICH exact domain and script is giving the problems, but you can narrow down the suspects now..


If you have a suspect and it happens often, you could add the following to his/her httpd.conf:
CustomLog "| /var/log/httpd/access_pid_log 86400" "%v|%f|%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %P"

This will create a file /var/log/httpd/access_pid_log with all entries for that domain AND the process ID of the httpd process serving the request at the end, so you can see which httpd process got stuck, and if it was that domain/script causing it..
 
Back
Top