httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Temme <scte...@apache.org>
Subject Re: [users@httpd] ServerLimit
Date Mon, 20 Nov 2006 16:35:55 GMT
Hi Emma,

On Nov 20, 2006, at 7:54 AM, Emma Lovatt wrote:

> I have read some conflicting information on how to up the max_clients
> directive.

There's really only one way: in the configuration file. See conf/ 
extra/httpd-mpm.conf for suggestions.

> Could someone explain the process to me a little better if possible or
> point me in the direction of some docs,  I am really struggling to  
> find
> some decent documentation on this.

You should not need to muck in the source code: tuning the  
ServerLimit and MaxClients directives should be all you need.  For  
instance, if you want a maximum of 1024 child processes, tell Apache:

ServerLimit 1024
MaxClients 1024

There is, however, something screwy going on: the order of these  
directives in the configuration file matters!  The code that  
implements the MaxClients directive checks the internal value of the  
ServerLimit directive at that time, and if that hasn't been set yet  
it'll emit the following warning:

WARNING: MaxClients of 1024 exceeds ServerLiimit value of 256 server,
  lowering MaxClients to 256.  To increase, please see the ServerLimit
  directive.

Switch the above around, restart your server and you'll see this  
happen until you switch it back. And they'll still both show up as  
1024 in mod_info!  Quite maddening if you don't know what's going on.

> Here is the part of the prefork.c I think I have to tweak :).
>
> #ifndef DEFAULT_SERVER_LIMIT
> #define DEFAULT_SERVER_LIMIT 256
> #endif

Once again, you shouldn't need to tune at compile time. However, if  
you desperately want to do so, yes this is the value to tweak.

The eventual value should be in relation to your memory, CPU, bus and  
network power. Find out using top how much memory each process takes  
(note that there is a shared memory portion that only gets allocated  
once across all processes) and divide that across the total available  
memory. However, you probably shouldn't go too high because you'll  
run into CPU, bus and mutex concurrency issues before you run out of  
memory. The kernel will use extra RAM as file system cache, so it's  
never wasted.

S.

-- 
sctemme@apache.org            http://www.temme.net/sander/
Open Source Software Consultant
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF




Mime
View raw message