I have been using the following configuration for a few years in production successfully serving 200+ concurrent requests per second on a single node. ##################### ##### KeepAlive ##### ##################### # Enables HTTP persistent connections default is On KeepAlive On # Amount of time the server will wait for subsequent requests on a persistent connection default 15 KeepAliveTimeout 15 MaxKeepAliveRequests 100 # Amount of time (seconds) the server will wait for certain events before failing a request default 300 TimeOut 45 ###################### ##### 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 # Original <IfModule mpm_worker_module> StartServers 4 MaxClients 384 ThreadLimit 25 ServerLimit 6 MinSpareThreads 25 MaxSpareThreads 400 ThreadsPerChild 64 MaxRequestsPerChild 0 MaxMemFree 100000 # 0 - child process never dies MaxRequestsPerChild 0 </IfModule> Sam -----Original Message----- From: Tom Evans [mailto:tevans.uk@xxxxxxxxxxxxxx] Sent: Friday, September 28, 2012 7:04 AM To: users@xxxxxxxxxxxxxxxx Subject: Re: apache getting stuck after reaching max number of max clients On Fri, Sep 28, 2012 at 3:04 AM, val john <valjohn1647@xxxxxxxxx> wrote: > Hi.. guys > > My apache config as follows , > > # > Timeout 1000 > KeepAlive Off > MaxKeepAliveRequests 500 > KeepAliveTimeout 15 > > <IfModule mpm_prefork_module> > StartServers 5 > MinSpareServers 5 > MaxSpareServers 10 > MaxClients 150 > MaxRequestsPerChild 500 > </IfModule> > > my apache getting stuck once hour due following error in the log [1], im > using Debian 5 and have 4G memory... , what can i do for fix this > issue..? . > > my memory is also fully utilized , > > total used free shared buffers cached > Mem: 3962 3934 27 0 231 3167 > -/+ buffers/cache: 534 3427 > Swap: 8192 0 8192 > > > > > [1] Error > ====== > Thu Sep 27 18:25:42 2012] [error] server reached MaxClients setting, > consider raising the MaxClients setting > [Thu Sep 27 18:29:08 2012] [error] [client 203.143.18.194] File does not > exist: /htdocs > [Thu Sep 27 18:35:26 2012] [error] [client 203.143.18.194] File does not > exist: /htdocs > > > Thank You > john What are you running on the server? Prefork is not a particularly efficient way of servicing a large number of clients, since each connected client - including keep alive connections - consumes an entire apache process. On our high traffic servers, we use the event MPM, which handles keep alive connections in a much more efficient manner, whilst not requiring so much memory to support each connected client. The downside is that things like mod_php do not work well in threaded environments (some might say this is an upside); instead you can use php-fcgi to connect web apps into httpd. This actually gives you more control over the PHP processes, controlling how much memory and CPU each app can use. For instance, our event configuration looks like this: <IfModule mpm_event_module> StartServers 8 MaxClients 1024 MinSpareThreads 128 MaxSpareThreads 768 ThreadsPerChild 64 MaxRequestsPerChild 0 </IfModule> We start 8 processes, each with 64 threads, so we can handle initially 512 concurrent requests. If we ever have less than 128 spare threads/slots, then it will start more process until we do - each process adding 64 threads/slots, up to a maximum of 1024 concurrent requests. This uses less than 1GB of RAM in total, but bear in mind that in our case, this server only serves static files and reverse proxying to application servers. If you can't move off prefork, and your server is out of memory, then whatever you do, do not increase MaxClients! You do not want to start swapping processes to disk, as this will make each request take longer to process, which will make the server become even more overloaded. Cheers Tom --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx ---------------------------------------------------------------------- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx