apache bad configuration
am 01.04.2008 15:35:37 von domnulnopcea
Hello guys!
I own a big site, 4000 unique visitors a day which runs apache 2! I
have a huge problem! Hourly the load on the server gets huge like 60
or 67. this is because i have more than 150 apache processes! they use
to much cpu!
i give the apache2ctl restart command and in 5 minutes the load gets
under 1. but after an hour the huge load is back!
this is my apache configuration
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited
amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request
from the
# same client on the same connection.
#
KeepAliveTimeout 300
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept
spare
# MaxSpareServers: maximum number of server processes which are kept
spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process
serves
StartServers 1
MinSpareServers 50
MaxSpareServers 100
MaxClients 250
MaxRequestsPerChild 250
i use prefork!!
do you have any ideea why i get this! i am desperate! i lose many
visitors single day!!
please help me!!
thank you in advance!!!
Re: apache bad configuration
am 01.04.2008 21:07:05 von phantom
"domnulnopcea" wrote in message
news:c6e82bd7-44b5-4c3e-b966-73627d8cc99b@i12g2000prf.google groups.com...
> Hello guys!
>
> I own a big site, 4000 unique visitors a day which runs apache 2! I
> have a huge problem! Hourly the load on the server gets huge like 60
> or 67. this is because i have more than 150 apache processes! they use
> to much cpu!
>
This will not necessarily be a problem for apache itself, it is more likely
something in the make up of your site that is the problem.
Presumably your site is not just flat html files?- you're using some kind of
scripting language - php/perl etc... a script that uses a lot of resources
(CPU/disk IO) can slow you down.
Maybe you are using a database too? these can be vey disk intensive if you
have not configured them well.
The first thing that you might want to try is turning ExtendedStatus on and
using mod_status's /server-status to tell you what apache is running when
the site is getting busy.
Also, let us know what you site uses in terms of scripting
language/database.
Re: apache bad configuration
am 02.04.2008 02:12:58 von sean dreilinger
domnulnopcea wrote:
> Hello guys!
>
> I own a big site, 4000 unique visitors a day which runs apache 2! I
> have a huge problem! Hourly the load on the server gets huge like 60
> or 67. this is because i have more than 150 apache processes! they use
> to much cpu!
remember that CPU is not the only bottleneck that you could be experiencing, and
that load (or load average) is not a pure measure of CPU utilization:
http://en.wikipedia.org/wiki/Load_average
Note that the load average (when it includes blocked processes) is not a
measure solely of CPU utilization, it is also a measure of disk I/O and,
sometimes, network performance. The CPU is only one factor in overall
system performance (and is often the least significant).
> i give the apache2ctl restart command and in 5 minutes the load gets
> under 1. but after an hour the huge load is back!
MaxClients is an important configuration directive and it varies depending on
the application(s) you're running and how the hardware is configured. you
shouldn't be using a default setting here.
take a look at the memory footprint of your apache processes after the server
has been handling traffic for a while (maybe after 30 minutes, if it locks up at
60 minutes), and adjust the MaxClients configuration directive to something
appropriate for the amount of memory available on your server:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclie nts
for example, if your server has 2,000 mb of RAM available and each apache
process uses 25 mb, then you'll have a MaxClients setting somewhere around 80
(maybe more depending on how much memory is shared between apache children).
if you notice the memory footprint of apache growing out of control over time,
its possible that something you've programmed (in an apache module like php,
perl, or ruby) is to blame. until that is debugged, you can lower the apache
MaxRequestsPerChild directive:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxrequ estsperchild
to force apache to expire children before they get too bloated. apache on some
OSs supports RLimit* directives that might also be helpful.
performance tuning gets more and more specific to your site and what you're
running. once you've solved your immediate headache you could probably make
further performance improvements by walking through some apache performance
tuning articles like these:
http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
http://virtualthreads.blogspot.com/2006/01/tuning-apache-par t-1.html
http://linuxgazette.net/123/vishnu.html
http://www.devside.net/articles/apache-performance-tuning
hth
--sean
--
sean dreilinger - http://durak.org/sean/
Re: apache bad configuration
am 02.04.2008 04:11:50 von Jim G
Are you on shared hosting by chance? Also are you into swap? (To tell you
can do a simple top from shell and it will show you). You could also comment
out some of the LoadModule from the httpd.conf file to free up some memory
when apache starts. That wont help alot but every little bit will do. Can
you post your httpd.conf file somewhere so we can have a look at it. Some
settings (like maxclients) can be set too high and your server can be trying
to start too many apache processes and just doesnt have the resources to
handle it. Another thing could be the html/php coding that you are using. I
run a site that gets 200,000 uniques a day, the load average stays under 1,
but thats with alot of httpd.conf tweaking and php tweaking as well. How
much ram does this server have? Have you checked hard drive space? (a simple
df -k will tell you). How many things are running when you start the server?
(ps -aux from shell).
Just remember that your issue could also be related to something other than
apache.
Jim
"domnulnopcea" wrote in message
news:c6e82bd7-44b5-4c3e-b966-73627d8cc99b@i12g2000prf.google groups.com...
> Hello guys!
>
> I own a big site, 4000 unique visitors a day which runs apache 2! I
> have a huge problem! Hourly the load on the server gets huge like 60
> or 67. this is because i have more than 150 apache processes! they use
> to much cpu!
>
> i give the apache2ctl restart command and in 5 minutes the load gets
> under 1. but after an hour the huge load is back!
>
> this is my apache configuration
>
> KeepAlive On
>
> #
> # MaxKeepAliveRequests: The maximum number of requests to allow
> # during a persistent connection. Set to 0 to allow an unlimited
> amount.
> # We recommend you leave this number high, for maximum performance.
> #
> MaxKeepAliveRequests 100
>
> #
> # KeepAliveTimeout: Number of seconds to wait for the next request
> from the
> # same client on the same connection.
> #
> KeepAliveTimeout 300
>
> ##
> ## Server-Pool Size Regulation (MPM specific)
> ##
>
> # prefork MPM
> # StartServers: number of server processes to start
> # MinSpareServers: minimum number of server processes which are kept
> spare
> # MaxSpareServers: maximum number of server processes which are kept
> spare
> # MaxClients: maximum number of server processes allowed to start
> # MaxRequestsPerChild: maximum number of requests a server process
> serves
>
> StartServers 1
> MinSpareServers 50
> MaxSpareServers 100
> MaxClients 250
> MaxRequestsPerChild 250
>
>
> i use prefork!!
>
> do you have any ideea why i get this! i am desperate! i lose many
> visitors single day!!
>
> please help me!!
>
> thank you in advance!!!