httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <>
Subject Re: [users@httpd] problems benchmarking php-fpm/proxy_fcgi with h2load
Date Sun, 21 Jan 2018 12:42:29 GMT
[Moved from users@]

On Sat, Jan 20, 2018 at 9:57 PM, Luca Toscano <> wrote:
> 2018-01-20 20:23 GMT+01:00 Luca Toscano <>:
>> 2018-01-19 17:40 GMT+01:00 Yann Ylavic <>:
>>> On Fri, Jan 19, 2018 at 5:14 PM, Yann Ylavic <>
>>> wrote:
>>> > On Fri, Jan 19, 2018 at 1:46 PM, Daniel <> wrote:
>>> >> I vaguely recall some issue with reuse when using unix socket files
>>> >> it was deliberately set to off by default, but yes, perhaps someone
>>> >> experienced enough with mod_proxy_fcgi inner workings can shed some
>>> >> light on this and the why yes/not.
>>> >>
>>> >> With socket files I never tried to enable "enablereuse=on" and got
>>> >> much successful results, so perhaps it's safer to keep it off until
>>> >> someone clarifies this issue, after all when dealing with unix sockets
>>> >> the access delays are quite low.
>>> >
>>> > {en,dis}ablereuse has no effect on Unix Domain Sockets in mod_proxy,
>>> > they are never reused.
>>> Well, actually it shouldn't, but while the code clearly doesn't reuse
>>> sockets (creates a new one for each request), nothing seems to tell
>>> the recycler that it should close them unconditionally at the end of
>>> the request.
>> Would you mind to point me to the snippet of code that does this? I am
>> trying to reproduce the issue and see if there is a fd leak but didn't
>> manage to so far..

Finally, after re-reading the code, I'm not sure the issue is in httpd.
In ap_proxy_connect_backend(), we expect ap_proxy_check_connection()
to check whether the connection can be reused or not, and it should
work for Unix sockets too.
I missed that call in my first analysis, so thought a new socket was
always created...

> I am now able to reproduce with Hajo's settings, and indeed with
> enablereuse=on I can see a lot of fds leaked via lsof:
> httpd     3230 3481    www-data   93u     unix 0xffff9ada0cf60400      0t0
> 406770 type=STREAM
> httpd     3230 3481    www-data   94u     unix 0xffff9ada0cf60800      0t0
> 406773 type=STREAM
> httpd     3230 3481    www-data   95u     unix 0xffff9ada0cf66400      0t0
> 406776 type=STREAM
> [..]

Reusing connections means that we can have ThreadsPerChild sockets per
backend (per child process).
Is it really a leak (the more requests, the more sockets, never
closed), or does it stop at ThreadsPerChild?

> With Yann's patch I cannot seem them anymore, anche h2load does not stop at
> 50%/60% but completes without any issue. I am still not able to understand
> why this happens reading the proxy_util.c code though :)

My patch simply disables connections recycling/reuse for Unix sockets,
but it's probably not the right since that's supposed to work.
Could it be that php-fpm simply does not like connections
keepalive/reuse? There may be a reason why we disablereuse by default
in mod_proxy_fcgi...
Where do communications stop working at 60%, something in the error
log? Possibly some tcpdump/wireshark between proxy_fcgi and the
backend could help here too.


View raw message