Re: apache getting stuck after reaching max number of max clients

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux