You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Emma Lovatt <em...@ticketline.co.uk> on 2006/11/20 16:54:28 UTC

[users@httpd] ServerLimit

Hi guys


I am running 4 x dual 2.8GHz blades with 4Gb RAM load balanced.  These
are running apache 2.2.3, openssl 0.98c and PHP 5.1.6.  They are
configured with MPM prefork.

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

My setup is as default, the Max_Clients is set to 256. I would like to
raise my max_client limit as we regularly would exceed these and I have
read that I would need to raise the server limit in prefork.c.


Here is the part of the prefork.c I think I have to tweak :).

#ifndef DEFAULT_SERVER_LIMIT
#define DEFAULT_SERVER_LIMIT 256
#endif

/* Admin can't tune ServerLimit beyond MAX_SERVER_LIMIT.  We want
 * some sort of compile-time limit to help catch typos.
 */
#ifndef MAX_SERVER_LIMIT
#define MAX_SERVER_LIMIT 200000
#endif

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.


Thanks in Advance

Em





- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This e-mail (and any attachments) is confidential and may be privileged. If you are not the intended recipient do not copy, use, or rely on them.
We do not accept any legal responsibility for the contents of this communication due to the generally insecure nature of email.
The views and opinions expressed within this email are those of the author and are not necessarily those of 'Piccadilly Ticketline' or any subsidiary.
If you received this email in error, please notify us immediately. PiccadillyTicketline has taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses.
However, Ticketline cannot accept liability for any damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any email or attachment.

- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] ServerLimit

Posted by Sander Temme <sc...@apache.org>.
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