httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: Apache pool management
Date Sat, 25 May 2013 08:51:32 GMT
On 2013-05-25 10:05, Sindhi Sindhi wrote:
> You have answered all my questions and thanks a lot. Had two questions
> more, appreciate your response.
>
> 1.
> As of now, my httpd.conf file has the below lines-
> # Server-pool management (MPM specific)
> #Include conf/extra/httpd-mpm.conf
>
> This means Apache does not read the httpd-mpm.conf file during startup. And
> so it uses the default settings for "Max number of requests it can support"
> and "Max number of threads it creates per child process"
>
> Where can I find what default values Apache uses for the following -
> - Upto how many concurrent requests will Apache support by default
> - Max number of threads that one child process creates
>
> For ex. if I want Apache to handle upto 400 concurrent requests at a time,
> how will I know that this 400 is within the default settings that Apache
> uses.


Have a look here, depending on your version of apache.
http://httpd.apache.org/docs/2.2/mod/mpm_common.html
http://httpd.apache.org/docs/2.4/mod/mpm_common.html

The number of threads per process is given in ThreadsPerChild.

You typically tweak

ServerLimit (the maximum number of children that are simultaneously alive)
ThreadLimit (the maximum sum of alive threads in all children)
StartServers (how many children are created upon startup)
ThreadsPerChild
MaxRequestWorkers (or MaxClients in 2.2) (the maximum number of requests 
that are served simultaneously)
MaxConnectionsPerChild (or MaxRequestsPerChild in 2.2) (after a child 
has served that many requests, it exits and is potentially replaced with 
a new child; avoids memleaks)
MinSpareThreads and MaxSpareThreads, the minimum and maximum number of 
spare threads.

There are some constraints on the arguments of these directives, which I 
do not master. I think that MaxRequestWorkers <= ThreadsPerChild * 
ServerLimit and that MaxRequestWorkers and ThreadLimit should be 
divisible by ThreadsPerChild, but as I said, I do not master. If you get 
them wrong, apache adjusts the values automatically and informs you 
about it upon startup.

I am not sure, maybe others on the list can confirm or deny, but I think 
that apache does not distinguish between threads and processes in 
windows: http://httpd.apache.org/docs/2.4/mod/mpm_winnt.html or 
http://httpd.apache.org/docs/2.2/mod/mpm_winnt.html. So I think that 
ServerLimit = 1 in Windows and probably MaxConnectionsPerChild is not 
used or does not exist.

You may also have a look at KeepAlive On|Off, MaxKeepAliveRequests and 
KeepAliveTimeout (http://httpd.apache.org/docs/2.4/mod/core.html)

If my module is on the internet with hundreds of thousands of possible 
client IPs that issue one request and then leave, I set KeepAlive Off. 
If my module is on the intranet and is accessed by a couple of 
webservices that continuously issue requests, I set it On with a short 
timeout. Performance-wise the KeepAlive directive makes a huge difference.

> 2.
> My understanding is, once a request is completely processed, Apache frees
> the pool of only this request and does not free any other request's pool.
> And other request pools will be freed only when those requests are
> completely processed. Kindly confirm my understanding to be correct.

Yes, it is correct.


Sorin


Mime
View raw message