You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2008/02/13 16:27:26 UTC
DisableReuse for mod_proxy
I added something similar to mod_jk quite awhile ago, and
I'm trying to get mod_jk and mod_proxy closer to parity,
esp for those using AJP. So with that in mind, comments
on the below??
Index: docs/manual/mod/mod_proxy.xml
===================================================================
--- docs/manual/mod/mod_proxy.xml (revision 627440)
+++ docs/manual/mod/mod_proxy.xml (working copy)
@@ -693,6 +693,16 @@
in the pool the Apache will return <code>SERVER_BUSY</code>
status to
the client.
</td></tr>
+ <tr><td>disablereuse</td>
+ <td>Off</td>
+ <td>This parameter should be used when you want to force
mod_proxy
+ to immediately close a connection to the backend after being
used, and
+ thus, disable its persistant connection and pool for that backend.
+ This helps in various situations where a firewall between Apache
and
+ the backend server (irregardless of protocol) tends to silently
+ drop connections. To prevent mod_proxy from reusing the backend
connection,
+ set this property value to <code>On</code>.
+ </td></tr>
<tr><td>flushpackets</td>
<td>off</td>
<td>Determines whether the proxy module will auto-flush the
output
Index: CHANGES
===================================================================
--- CHANGES (revision 627440)
+++ CHANGES (working copy)
@@ -2,6 +2,10 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]
+ *) Added 'disablereuse' option for ProxyPass which, essentially,
+ disables connection pooling for the backend servers.
+ [Jim Jagielski]
+
*) Activate mod_cache, mod_file_cache and mod_disc_cache as part
of the
'most' set for '--enable-modules' and '--enable-shared-mods'.
Include
mod_mem_cache in 'all' as well. [Dirk-Willem van Gulik]
Index: modules/proxy/proxy_util.c
===================================================================
--- modules/proxy/proxy_util.c (revision 627440)
+++ modules/proxy/proxy_util.c (working copy)
@@ -1698,7 +1698,7 @@
}
/* determine if the connection need to be closed */
- if (conn->close || !worker->is_address_reusable) {
+ if (conn->close || !worker->is_address_reusable || worker-
>disablereuse) {
apr_pool_t *p = conn->pool;
apr_pool_clear(p);
conn = apr_pcalloc(p, sizeof(proxy_conn_rec));
@@ -1902,8 +1902,13 @@
if (!worker->retry_set) {
worker->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
}
- /* By default address is reusable */
- worker->is_address_reusable = 1;
+ /* By default address is reusable unless DisableReuse is set */
+ if (worker->disablereuse) {
+ worker->is_address_reusable = 0;
+ }
+ else {
+ worker->is_address_reusable = 1;
+ }
#if APR_HAS_THREADS
ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
@@ -2114,7 +2119,8 @@
*
* TODO: Handle this much better...
*/
- if (!conn->hostname || !worker->is_address_reusable ||
+ if (!conn->hostname || !worker->is_address_reusable ||
+ worker->disablereuse ||
(r->connection->keepalives &&
(r->proxyreq == PROXYREQ_PROXY || r->proxyreq ==
PROXYREQ_REVERSE) &&
(strcasecmp(conn->hostname, uri->hostname) != 0) ) ) {
Index: modules/proxy/mod_proxy.c
===================================================================
--- modules/proxy/mod_proxy.c (revision 627440)
+++ modules/proxy/mod_proxy.c (working copy)
@@ -176,6 +176,15 @@
return "KeepAlive must be On|Off";
worker->keepalive_set = 1;
}
+ else if (!strcasecmp(key, "disablereuse")) {
+ if (!strcasecmp(val, "on"))
+ worker->disablereuse = 1;
+ else if (!strcasecmp(val, "off"))
+ worker->disablereuse = 0;
+ else
+ return "DisableReuse must be On|Off";
+ worker->disablereuse_set = 1;
+ }
else if (!strcasecmp(key, "route")) {
/* Worker route.
*/
Index: modules/proxy/mod_proxy.h
===================================================================
--- modules/proxy/mod_proxy.h (revision 627440)
+++ modules/proxy/mod_proxy.h (working copy)
@@ -352,6 +352,8 @@
char ping_timeout_set;
int lbset; /* load balancer cluster set */
char retry_set;
+ char disablereuse;
+ char disablereuse_set;
};
/*
Re: DisableReuse for mod_proxy
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Nick Kew wrote:
> On Wed, 13 Feb 2008 10:27:26 -0500
> Jim Jagielski <ji...@jaguNET.com> wrote:
>
>> + This helps in various situations where a firewall between
>> Apache and
>> + the backend server (irregardless of protocol) tends to silently
>
> irregardless??? Regardless?
or irrespective? (which is the origin of this word-abuse, I think ;-)
Re: DisableReuse for mod_proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 13, 2008, at 1:22 PM, Nick Kew wrote:
> On Wed, 13 Feb 2008 13:18:04 -0500
> Jim Jagielski <ji...@jaguNET.com> wrote:
>
>> I consider it a Good Sign when the comments are mostly
>> about the docs and how to better wordsmith them :)
>
> :-)
>
> Not quite sure what problem you're solving, but I accept you
> have a reason. But putting the docs first in your post means
> they catch the eye.
>
It's in whatever order svn diff creates 'em ;)
Re: DisableReuse for mod_proxy
Posted by Nick Kew <ni...@webthing.com>.
On Wed, 13 Feb 2008 13:18:04 -0500
Jim Jagielski <ji...@jaguNET.com> wrote:
> I consider it a Good Sign when the comments are mostly
> about the docs and how to better wordsmith them :)
:-)
Not quite sure what problem you're solving, but I accept you
have a reason. But putting the docs first in your post means
they catch the eye.
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
Re: DisableReuse for mod_proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 13, 2008, at 1:13 PM, Nick Kew wrote:
> On Wed, 13 Feb 2008 10:27:26 -0500
> Jim Jagielski <ji...@jaguNET.com> wrote:
>
>> + This helps in various situations where a firewall between
>> Apache and
>> + the backend server (irregardless of protocol) tends to silently
>
> irregardless??? Regardless?
>
>> + drop connections. To prevent mod_proxy from reusing the backend
>
> the split infinitive grates a bit, too. "tends to drop connections
> silently" would fix that grammatically. But perhaps just drop the
> "tends to", and substitute something like "may".
>
I consider it a Good Sign when the comments are mostly
about the docs and how to better wordsmith them :)
Re: DisableReuse for mod_proxy
Posted by Nick Kew <ni...@webthing.com>.
On Wed, 13 Feb 2008 10:27:26 -0500
Jim Jagielski <ji...@jaguNET.com> wrote:
> + This helps in various situations where a firewall between
> Apache and
> + the backend server (irregardless of protocol) tends to silently
irregardless??? Regardless?
> + drop connections. To prevent mod_proxy from reusing the backend
the split infinitive grates a bit, too. "tends to drop connections
silently" would fix that grammatically. But perhaps just drop the
"tends to", and substitute something like "may".
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
Re: DisableReuse for mod_proxy
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 13, 2008, at 10:45 AM, Erik Abele wrote:
> On 13.02.2008, at 16:27, Jim Jagielski wrote:
>
>> I added something similar to mod_jk quite awhile ago, and
>> I'm trying to get mod_jk and mod_proxy closer to parity,
>> esp for those using AJP. So with that in mind, comments
>> on the below??
>>
>> Index: docs/manual/mod/mod_proxy.xml
>> ===================================================================
>> --- docs/manual/mod/mod_proxy.xml (revision 627440)
>> +++ docs/manual/mod/mod_proxy.xml (working copy)
>> @@ -693,6 +693,16 @@
>> in the pool the Apache will return <code>SERVER_BUSY</code>
>> status to
>> the client.
>> </td></tr>
>> + <tr><td>disablereuse</td>
>> + <td>Off</td>
>> + <td>This parameter should be used when you want to force
>> mod_proxy
>> + to immediately close a connection to the backend after being
>> used, and
>> + thus, disable its persistant connection and pool for that
>> backend.
>
> "persistent" instead of "persistant"?
>
> +1 to the rest.
>
me no spelll too guud :)
Re: DisableReuse for mod_proxy
Posted by Erik Abele <er...@codefaktor.de>.
On 13.02.2008, at 16:27, Jim Jagielski wrote:
> I added something similar to mod_jk quite awhile ago, and
> I'm trying to get mod_jk and mod_proxy closer to parity,
> esp for those using AJP. So with that in mind, comments
> on the below??
>
> Index: docs/manual/mod/mod_proxy.xml
> ===================================================================
> --- docs/manual/mod/mod_proxy.xml (revision 627440)
> +++ docs/manual/mod/mod_proxy.xml (working copy)
> @@ -693,6 +693,16 @@
> in the pool the Apache will return <code>SERVER_BUSY</code>
> status to
> the client.
> </td></tr>
> + <tr><td>disablereuse</td>
> + <td>Off</td>
> + <td>This parameter should be used when you want to force
> mod_proxy
> + to immediately close a connection to the backend after being
> used, and
> + thus, disable its persistant connection and pool for that
> backend.
"persistent" instead of "persistant"?
+1 to the rest.
Cheers,
Erik