HI Dean
it's normal that the ProxyPass open a lots of connection to php-fpm
instance. The same behavior can be noticed with Nginx, and in same case
some people suggest to use the UNIX socket to open the connections to
PHP-FPM, but you have to test the performances.
You can tune the kernel parameter to reuse the connections in TIME_WAIT
state, with net.ipv4.tcp_tw_reuse but also check the performances and
behavior if you have your server behind a load balancer.
Marcello
On 11/14/2013 10:12 PM, Chandler, Dean A 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.
<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..