>-----Message d'origine----- >De : Jim Jagielski [mailto:[EMAIL PROTECTED] >Envoyé : lundi 3 septembre 2007 14:56 >À : [email protected] >Objet : Re: Apache 2.2.x: Implicit creation of new proxy_workers > > >That's right. You can't really have a connection pool if the >endpoint is unknown or changing :) > >You could of course, as you said, create a patch which, >once the generic worker is used, "add" it to the pool, >but this is not trivial to do as 1st glance.
First of all, thanks for your comments (Jim + Rüdiger). I finally managed to get a working implementation of what I initially proposed, which was to create new workers on the fly as new backends for which no worker exists appear. This can happen if a RewriteRule proxies a request (with the [P] flag), and the backend URL does not match any of the ProxyPass' second argument (URL). 1. New workers are created for scheme://address/. The URL path is ignored. One might want to add a new configuration directive for specifying the number of path elements to include in the worker name. 2. The request for which the worker is created is served using the default worker. The connection pool for the new worker is then only populated on the first request matching the new worker (the 2nd request), and an existing connection may only be reused from the following request on. 3. There is no way to tune the connection pooling of the workers created on-the-fly. 4. One might want to add a new configuration directive for (de-)activating this mechanism Regarding the implementation details, being a novice to Apache development, I look forward to your comments. However i) PROXY_COPY_CONF_PARAMS should probably be moved to mod_proxy.h to avoid duplication ii) I allocate a copy of the URL on the stack rather than out of the pool since as far as I could see, it is duplicated in ap_proxy_add_worker() anyway iii) Someone skilled in the art of Apache httpd development could probably come up with a way that the newly created worker could be used immediately instead of having to wait for the next request. I will create a Bugzilla report for this issue. BR -ascs
proxy_util.c.patch
Description: proxy_util.c.patch
