You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Joshua Marantz <jm...@google.com> on 2011/09/01 23:39:10 UTC

Detecting which MPM a module is running in

Hello from mod_pagespeed again.

We are adding support for running in the Worker MPM, having spent most of
our time since we launched the product sheltered in the prefork MPM where
our multi-threading challenges are all of our own making.

Having tuned our threading model for prefork, where all request-parallelism
will come at the process level, we now offer a functional but, almost
certainly, suboptimal experience for Worker MPM users.

In particular, for a given server_rec, in prefork we are only going to be
processing one request at a time, hence we should employ only a small number
of worker threads to help us.  But in Worker MPM, from what I've seen, a
single server_rec can service multiple concurrent requests.  Thus I think we
should be aware of this and bump up the number of worker threads we create
to help us.

Is it possible to detect the MPM under which mod_pagespeed is running, or,
more generally, the number of concurrent requests that the current process
is likely to need to handle?

Thanks!
-Josh

Re: Detecting which MPM a module is running in

Posted by Rainer Jung <ra...@kippdata.de>.
On 01.09.2011 23:39, Joshua Marantz wrote:
> Hello from mod_pagespeed again.
> 
> We are adding support for running in the Worker MPM, having spent most of
> our time since we launched the product sheltered in the prefork MPM where
> our multi-threading challenges are all of our own making.
> 
> Having tuned our threading model for prefork, where all request-parallelism
> will come at the process level, we now offer a functional but, almost
> certainly, suboptimal experience for Worker MPM users.
> 
> In particular, for a given server_rec, in prefork we are only going to be
> processing one request at a time, hence we should employ only a small number
> of worker threads to help us.  But in Worker MPM, from what I've seen, a
> single server_rec can service multiple concurrent requests.  Thus I think we
> should be aware of this and bump up the number of worker threads we create
> to help us.
> 
> Is it possible to detect the MPM under which mod_pagespeed is running, or,
> more generally, the number of concurrent requests that the current process
> is likely to need to handle?

Have a look at ap_mpm_query() in ap_mpm.h. In 2.2.x you can query for:

AP_MPMQ_MAX_DAEMON_USED       Max # of daemons used so far
AP_MPMQ_IS_THREADED           MPM can do threading
AP_MPMQ_IS_FORKED             MPM can do forking
AP_MPMQ_HARD_LIMIT_DAEMONS    The compiled max # daemons
AP_MPMQ_HARD_LIMIT_THREADS    The compiled max # threads
AP_MPMQ_MAX_THREADS           # of threads/child by config
AP_MPMQ_MIN_SPARE_DAEMONS     Min # of spare daemons
AP_MPMQ_MIN_SPARE_THREADS     Min # of spare threads
AP_MPMQ_MAX_SPARE_DAEMONS     Max # of spare daemons
AP_MPMQ_MAX_SPARE_THREADS     Max # of spare threads
AP_MPMQ_MAX_REQUESTS_DAEMON   Max # of requests per daemon
AP_MPMQ_MAX_DAEMONS           Max # of daemons by config
AP_MPMQ_MPM_STATE             starting, running, stopping
AP_MPMQ_IS_ASYNC              MPM can process async connections

Regards,

Rainer