Hi,

Right now any event happening in mpm child process
is per request based. As an example I'll give
mod_proxy and its connection pool. The connection_pool
maintenance happens only when a request comes in which
is fine for a frequently accessed server. If there
is no request for a long time the ttl (time to live)
is useless cause nothing can call the maintenance.

I propose we create a single maintenance thread (configurable)
for each child process (on creation) with child lifetime,
and configurable interval that will call module callbacks
registered to this hook.

Something like in register hooks:
ap_hook_watchdog(watchdog_handler, NULL, NULL, APR_HOOK_FIRST);

The maintenance (watchdog) thread would call registered
hooks at configured interval independent from the request
rate allowing modules to do what ever needed.

Usage examples:
mod_proxy connection pool maintenance
mod_balancer decaying (averaging) the transferred statistics,
             so that node-up/recovery doesn't consume all the load.
mod_proxy_ajp sending ping/pong at regular intervals (detecting
              node failure before request)
mod_cache probably lots of use cases since its time interval related

I'm not sure if the hook is a correct API to choose or
something like ap_register_provider API that will allow
module to register the desired watchdog interval, or something.

Right now this can be done on per-module basis by creating
the thread on child_init (we have that in mod_jk for example),
but this can lead to multiple threads created by modules
basically only calling some function at regular intervals.
Having that server wide would lower down the resource usage
although it might lead to serialization problems if the
callback takes a long time to execute.

Comments, other ideas?

Regards
--
^(TM)

Reply via email to