Sunday, December 21, 2008

just apache httpd (WARNING: MaxClients of ... exceeds ServerLimit value of 256 servers)


Using httpd 2.x.x (source-code) and then need to increase MaxClients > 256 for mpm_prefork_module.

<  IfModule mpm_prefork_module >
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients         257
    MaxRequestsPerChild   0
<  /IfModule >

# apachectl start

WARNING: MaxClients of 257 exceeds ServerLimit value of 256 servers,
 lowering MaxClients to 256.  To increase, please see the ServerLimit
 directive.

Found Warning... 

Solving this case when we use HTTPD compiled from source-code, increase size.

- Go to Source-Code PATH
# cd SOURCE_HTTPD
# cd server/mpm/prefork
- Modified prefork.c file.
# vi prefork.c 
Old:
#define DEFAULT_SERVER_LIMIT 256

New:
#define DEFAULT_SERVER_LIMIT 1024

*** Increase to 1024*** 

- Reinstall httpd 
# cd SOURCE_HTTPD
# make clean
# make 
# make install
Or
# pwd
SOURCE_HTTPD/server/mpm/prefork

# make clean 
# make 
# cd SOURCE_HTTPD
# make install

- Start httpd again.

2 comments:

erikig said...

You can also add ServerLimit 1024 into httpd.conf.

Surachart said...

Wow! Thank You for Your response.
That's a good ...
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#serverlimit

Example:
I compile to support ServerLimit Default 2048

StartServers 50
MinSpareServers 50
MaxSpareServers 100
MaxClients 2049
MaxRequestsPerChild 0

# apachectl start
WARNING: MaxClients of 2049 exceeds ServerLimit value of 2048 servers,
lowering MaxClients to 2048. To increase, please see the ServerLimit directive.

Edit httpd-mpm.conf

StartServers 50
MinSpareServers 50
MaxSpareServers 100
MaxClients 2049
MaxRequestsPerChild 0
ServerLimit 20000

# apachectl start
WARNING: MaxClients of 2049 exceeds ServerLimit value of 2048 servers,
lowering MaxClients to 2048. To increase, please see the ServerLimit directive.

So, edit again...

StartServers 50
ServerLimit 20000
MinSpareServers 50
MaxSpareServers 100
MaxClients 2049
MaxRequestsPerChild 0

# apachectl start
--- No Warning ---

Just Fun ;)