Apache Tuning

Hi Friends, This regarding tuning apache. I am running 100+ LAMP on VPS. But few of them are crashing becoz it reaches to the MaxClient Limit. I thought of Tuning. Here are the specs:

OS: OpenSuse 10
Apache: Apche/2.2.8
PHP: PHP 5.x
RAM: 1GB
Assuming 80% of it has been occupied by webserver (apache)

Apache Settings: These are pretty old settings. I have doubt that these needs to be recompile.

# prefork MPM
StartServers 50
MinSpareServers 5
MaxSpareServers 100
ServerLimit 50
MaxClients 50
# worker MPM
StartServers 50
MinSpareThreads 5
MaxSpareThreads 100
ThreadLimit 128
MaxClients 50
ThreadsPerChild 75
MaxRequestsPerChild 10000

whenever i run
ps -eLf|grep httpd |wc -l
It alwasys give me = 52 and in the peak hours something apache crashes saying reached the Maximun Client size.

No as per the thumb rule.

MaxClients (RAM - size_all_other_processes)/(size_apache_process)
which is like
MaxClients (RAM dedicated to Apache)/(Average of apache process)
Numbers:

MaxClients Total Ram 1GB - 20% for other process/ Average of RSS (1226304) in KB offcource.

(Note: For RSS i an doing ps -ylC httpd --sort:rss, and calculating the average of all 52 process)

Now, Here is the problem when i do all this calculation, i end up with a result that i am using less RAM, which is quite a numb because these servers are running for last few years with no problem.

So, i was wondering if you guys can give me some direction for the tunning..thasn that would be help.

Did I understand you correctly that you only pay for 1 GB RAM?

If so, buy more. 1 GB is not enough.

I had this problem abt 3years back, we set maxclients but the moment [ps -ef |grep -i httpd | wc -l) = maxclient+2 it will crash. No matter how high we set it just kept reaching that threshold and crash.

I can't remember where in the config but we finally turned it off and it solved the problem. but our app was running jboss and that too had it's own set of problems and it too started crashing.

But If you ask me this maxlclient setting is quite dumb. Turn it off if you don't need it.

Thanks Neo for Replying. but My question is all of my configuration are the same. 1Gb ram and 17 to 35GB HD. some of them are running absolutely fine. More over Apache is a light weighted application....if we can tune it proper than it should not take this much of memory.[COLOR="\#738fbf"]

Memory is so cheap.

Normally we tune and conserve valuable resourses.

That is why I aways advise more RAM. RAM is very cheap and 1 GB RAM is small for most semi-busy web servers.

It is cheaper to upgrade RAM than to spend human resources tuning.

absolutely whenever count goes MC+2 or MC+3 it crashes. I tied few things but i never stop to reach that point...and amazingly the pid count is always one of these 50,51,52

---------- Post updated at 11:11 AM ---------- Previous update was at 11:08 AM ----------

My Bad i think i forgot to mention that these are all running on VMware VPS. The configuration of the VPS is done on the basis of the contract done from customer side. So, Increasing RAM would be the last option here people will think on.

Here is our MPM config, FYI:

# 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
<IfModule mpm_prefork_module>
    StartServers         64
    MinSpareServers      64
    MaxSpareServers      128
    MaxClients           256
    MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          256
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

---------- Post updated at 06:30 ---------- Previous update was at 06:00 ----------

Ah. Yes, upgrading memory might be too expensive on a contract VPS configuration.

Anyway, I can't help about VPS provisioning, because every time we use any type of shared-hosting configuration for this site, the performance is not acceptable.