Or just 'reuse=On | reuse=Off' maybe? 

On Nov 15, 2013, at 11:51 AM, Jeff Trawick <[email protected]> wrote:

> On Thu, Nov 14, 2013 at 5:02 PM, Jim Jagielski <[email protected]> wrote:
> stop setting it all the time in that particular case?
> Would a ->notes work?
> 
> I'm thinking along these lines:
> 
> FastCGI connections should continue to default to closing connections even 
> with the default disablereuse=off since many setups will fail otherwise under 
> load.  (Even without the configuration migration concern it still seems like 
> a good idea.)
> 
> We could state that disablereuse is for protocol handlers which default to 
> reusing connections (e.g., http), and add enablereuse which is for protocol 
> handlers which default to NOT reusing connections (e.g., FastCGI).
> 
>  
> On Nov 14, 2013, at 4:29 PM, Jeff Trawick <[email protected]> wrote:
> 
> > Need a way to stop setting backend->close without breaking other users.
> >
> > FastCGI-specific keyword parameter?  envvar?
> >
> > ---------- Forwarded message ----------
> > From: Jeff Trawick <[email protected]>
> > Date: Thu, Nov 14, 2013 at 4:26 PM
> > Subject: Re: [users@httpd] mod_proxy doesn't persist connections to php-fpm
> > To: "[email protected]" <[email protected]>
> >
> >
> > On Thu, Nov 14, 2013 at 4:12 PM, Chandler, Dean A 
> > <[email protected]> wrote:
> > Hi,
> >
> >                 I am trying to run Apache 2.4 web server using mod_proxy 
> > and proxy_fcgi to proxy php requests to the PHP-FPM running on same 
> > machine.  I am pretty much using default setup for php-fpm.ini with port at 
> > 9000.  My problem is that mod_proxy is closing the connection after every 
> > request is complete so I end up with 1000’s of sockets in TIME_WAIT and 
> > eventually apache quits creating sockets. I am using the following proxy 
> > statement to send requests to the php-fpm process.
> >
> >
> > Funny...  I sent this long explanation to somebody recently with a 
> > suggestion on what to try:
> >
> > mod_proxy_fcgi should share mod_proxy's general ability to pool connections 
> > to a backend, but there has always been line of code in mod_proxy_fcgi that 
> > marks all connections for closure at the end of the request.  I just found 
> > the commit from 7 years ago that does it:
> >
> > http://svn.apache.org/viewvc?view=revision&revision=383278
> >
> > That line has subsequently moved around a little and the field changed; it 
> > looks like this now:
> >
> >     /* 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. */
> >     backend->close = 1;
> >
> > I think the point of the commit message is that:
> >
> > * typically you have small connection capacity in the FastCGI application
> > * typically your Apache configuration has a number of Apache child 
> > processes handling client requests
> >
> > In this typical scenario you can easily have a number of connections to the 
> > FastCGI application which are ready to be reused but they are owned by 
> > specific Apache child processes and the Apache child handling a request may 
> > not be the one that already has the connection, and the FastCGI app may not 
> > accept more connections until some of the other ones are closed.  (I.e., 
> > the new request waits for some timeout in the app which allows it to close 
> > an existing connection and accept a new one).
> >
> > If you have configured Apache with a very small number of child processes 
> > and YOUR-BACKEND has good connection capacity (i.e., will accept many 
> > concurrent connections), you could try commenting out that line 
> > "backend->close = 1" in the bit of code shown above and see how it works 
> > for you.  (Don't comment out every occurrence of "backend->close = 1", 
> > since the backend connection should be closed after certain types of 
> > errors.)
> >
> > Assuming that it works fine, check with netstat to see if the typical 
> > number of connections to YOUR-BACKEND decreased any.
> >
> > Reusing the same connections is only effective with a relatively small 
> > number of Apache child processes.  (I guess you are using Event or Worker 
> > MPM?)
> >
> >
> >
> >
> >
> > <LocationMatch ^/(.*\.php(/.*)?)$ >
> >
> >        ProxyPass fcgi://127.0.0.1:9000/home/httpbld/htdocs/$1 ttl=300000 
> > keepalive=On connectiontimeout=300 ttl=300 max=128
> >
> > </LocationMatch>
> >
> >
> >
> > Below is log file showing connections
> >
> >
> >
> >
> >
> > [Wed Nov 13 11:42:56.176124 2013] [proxy:debug] [pid 225428:tid 
> > 139934623480576] proxy_util.c(2194): [client 220.6.6.158:34023] AH00947: 
> > connected /home/httpbld/htdocs/status.html/status to 127.0.0.1:9000
> >
> > [Wed Nov 13 11:42:56.176159 2013] [proxy:trace2] [pid 225428:tid 
> > 139934623480576] proxy_util.c(2446): FCGI: fam 2 socket created to connect 
> > to 127.0.0.1
> >
> > [Wed Nov 13 11:42:56.176985 2013] [proxy_fcgi:trace4] [pid 225428:tid 
> > 139934623480576] util_script.c(521): [client 220.6.6.158:34023] Headers 
> > from script 'status':
> >
> > [Wed Nov 13 11:42:56.177038 2013] [proxy_fcgi:trace4] [pid 225428:tid 
> > 139934623480576] util_script.c(522): [client 220.6.6.158:34023]   
> > X-Powered-By: PHP/5.5.5
> >
> > [Wed Nov 13 11:42:56.177060 2013] [proxy_fcgi:trace4] [pid 225428:tid 
> > 139934623480576] util_script.c(522): [client 220.6.6.158:34023]   Expires: 
> > Thu, 01 Jan 1970 00:00:00 GMT
> >
> > [Wed Nov 13 11:42:56.177071 2013] [proxy_fcgi:trace4] [pid 225428:tid 
> > 139934623480576] util_script.c(522): [client 220.6.6.158:34023]   
> > Cache-Control: no-cache, no-store, must-revalidate, max-age=0
> >
> > [Wed Nov 13 11:42:56.177082 2013] [proxy_fcgi:trace4] [pid 225428:tid 
> > 139934623480576] util_script.c(522): [client 220.6.6.158:34023]   
> > Content-Type: text/plain
> >
> > [Wed Nov 13 11:42:56.177196 2013] [proxy:debug] [pid 225428:tid 
> > 139934623480576] proxy_util.c(2035): AH00943: FCGI: has released connection 
> > for (127.0.0.1)
> >
> >
> >
> > Please let me know if there is any way to enable reuse of connection to the 
> > php-fpm process.
> >
> >
> >
> >                 Thanks,
> >
> >                                 Dean..
> >
> >
> >
> >
> > --
> > Born in Roswell... married an alien...
> > http://emptyhammock.com/
> >
> >
> >
> > --
> > Born in Roswell... married an alien...
> > http://emptyhammock.com/
> 
> 
> 
> 
> -- 
> Born in Roswell... married an alien...
> http://emptyhammock.com/

Reply via email to