Apache - maximum number of threads?

I've tried to configure my Apache server to use a maximum of 120 threads and one (Oracle) SQL connection per thread. I did this by setting:

MaxClients 120

in httpd.conf file. I also set:

oci8.max_persistent = 1

in php.ini file.

However, I see the number of threads/connections occasionally going over 120. Am I missing something?

Thanks.


Solution 1:

As bindbn tells you, you should check the MPM

# apache2 -V | grep "Server MPM" 
Server MPM:     XXXX

And as you answer him, you're using 'prefork', configuration it's pretty similar to worker:

<IfModule prefork.c>
  StartServers            8
  MinSpareServers         5
  MaxSpareServers        20
  MaxClients            150
  MaxRequestsPerChild  1000
</IfModule>

More info:

http://www.devside.net/articles/apache-performance-tuning

http://www.camelrichard.org/apache-prefork-vs-worker

Solution 2:

Check MPM:

# apache2 -V | grep "Server MPM"
Server MPM:     Worker

Check that the correct section changed:

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      60
    ThreadLimit          55
    ThreadsPerChild      25
    MaxClients          120
    MaxRequestsPerChild   0
</IfModule>

http://httpd.apache.org/docs/current/mod/mpm_common.html