You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2014/12/20 16:38:28 UTC
svn commit: r1647005 - in /httpd/httpd/trunk: CHANGES
docs/manual/mod/mod_proxy_fcgi.xml modules/proxy/mod_proxy_fcgi.c
Author: covener
Date: Sat Dec 20 15:38:27 2014
New Revision: 1647005
URL: http://svn.apache.org/r1647005
Log:
Allow (a hokey) opt-in to connection reuse for mod_proxy_fcgi + TCP.
Connection reuse has been disabled since r1032345 at the end of
2011.
Attempt to reverse the polarity of the connection reuse doc which
has been wrong for a long time.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/docs/manual/mod/mod_proxy_fcgi.xml
httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1647005&r1=1647004&r2=1647005&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Dec 20 15:38:27 2014
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_proxy_fcgi: Enable opt-in to TCP connection reuse by explicitly
+ setting proxy option disablereuse=off. [Eric Covener] PR 57378.
+
*) mod_proxy_fcgi: Remove proxy:balancer:// prefix from SCRIPT_FILENAME
passed to fastcgi backends. [Eric Covener]
Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy_fcgi.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy_fcgi.xml?rev=1647005&r1=1647004&r2=1647005&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy_fcgi.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy_fcgi.xml Sat Dec 20 15:38:27 2014
@@ -68,30 +68,26 @@
</highlight>
</example>
- <p>This application should be able to handle multiple concurrent
- connections. <module>mod_proxy</module> enables connection reuse by
- default, so after a request has been completed the connection will be
- held open by that httpd child process and won't be reused until that
- httpd process routes another request to the application. If the
- FastCGI application is unable to handle enough concurrent connections
- from httpd, requests can block waiting for the application to close
- an existing connection. One way to resolve this is to disable connection
- reuse on the <directive>ProxyPass</directive> directive, as shown in
- the following example:</p>
+ <p> <module>mod_proxy_fcgi</module> disables connection reuse by
+ default, so after a request has been completed the connection will NOT be
+ held open by that httpd child process and won't be reused. If the
+ FastCGI application is able to handle concurrent connections
+ from httpd, you can opt-in to connection reuse as shown in the following
+ example:</p>
- <example><title>Single application instance, no connection reuse</title>
+ <example><title>Single application instance, connection reuse</title>
<highlight language="config">
- ProxyPass /myapp/ fcgi://localhost:4000/ disablereuse=on
+ ProxyPass /myapp/ fcgi://localhost:4000/ disablereuse=off
</highlight>
</example>
<p> The following example passes the request URI as a filesystem
path for the PHP-FPM daemon to run. The request URL is implicitly added
to the 2nd parameter. The hostname and port following fcgi:// are where
- PHP-FPM is listening.</p>
+ PHP-FPM is listening. Connection pooling is enabled.</p>
<example><title>PHP-FPM</title>
<highlight language="config">
- ProxyPassMatch ^/myapp/.*\.php(/.*)?$ fcgi://localhost:9000/var/www/
+ ProxyPassMatch ^/myapp/.*\.php(/.*)?$ fcgi://localhost:9000/var/www/ disablereuse=off
</highlight>
</example>
@@ -101,7 +97,8 @@
the hostname and optional port following fcgi:// are ignored.</p>
<example><title>PHP-FPM with UDS</title>
<highlight language="config">
- ProxyPassMatch ^/(.*\.php(/.*)?)$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/var/www/"
+ # UDS does not currently support connection reuse
+ ProxyPassMatch ^/(.*\.php(/.*)?)$ "unix:/var/run/php5-fpm.sock|fcgi://localhost/var/www/"
</highlight>
</example>
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?rev=1647005&r1=1647004&r2=1647005&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Sat Dec 20 15:38:27 2014
@@ -834,11 +834,15 @@ static int proxy_fcgi_handler(request_re
goto cleanup;
}
- /* XXX Setting close to 0 is a great way to end up with
- * timeouts at this point, since we lack good ways to manage the
- * back end fastcgi processes. This should be revisited when we
- * have a better story on that part of things. */
+ /* This scheme handler does not reuse connections by default, to
+ * avoid tieing up a fastcgi that isn't expecting to work on
+ * parallel requests. But if the user went out of their way to
+ * type the default value of disablereuse=off, we'll allow it.
+ */
backend->close = 1;
+ if (worker->s->disablereuse_set && !worker->s->disablereuse) {
+ backend->close = 0;
+ }
/* Step Two: Make the Connection */
if (ap_proxy_connect_backend(FCGI_SCHEME, backend, worker, r->server)) {